flexi search inside the impex

521 views Asked by At

I want to write an impex to disable an account with an particular user-id which contains the particular email id. let's say if email [email protected] is associated with the user id xyx then xyz account should be soft disabled (loginDisabled should be true). For getting the xyz user-id i gonna run the flexi search :

    select {emp.uid} as empid from { Employee as emp} where {emp.email} = '[email protected]'

this will return me the user-ids containing the email as [email protected]

and to disable a account i can run the impex as :

      UPDATE Employee; UID[unique = true]; groups;loginDisabled[default=true];
      xyz;;true

Now i want that both the Felxi serach and impex should be combined and the flexisearch should return the userid and impex part should disable the account, i have tried below impex but it didn't did anything:

     UPDATE Employee; UID[unique = true]; groups;loginDisabled[default=true]
     "#% impex.exportItemsFlexibleSearch(""select {emp.uid} as empid from { Employee as emp} where {emp.email} = '[email protected]'"");"

Thanks in advance for the help.

3

There are 3 answers

6
geffchang On

I'm sorry I misunderstood the question. I thought you were trying to export the data.

This is how you disable the log-in using impex:

UPDATE Employee;uid[unique=true];loginDisabled[default=true]
;[email protected];
0
arvind panchal On

I tried running

UPDATE Employee;PK[unique=True];groups(uid);loginDisabled[default=true] "#% impex.exportItemsFlexibleSearch("" SELECT {emp.pk} FROM { Employee AS emp} WHERE {emp.email} = '[email protected]' "");"

But no luck the impex is running without any issue but does not reflect the changes in backoffice

0
Adiputera On

I would suggest using a groovy script instead of flexible search.

The impex.exportItemsFlexibleSearch is, as the name say used for export only, so you are not be able to use it in import. If you want to use impex, then you should export first using impex.exportItemsFlexibleSearch, change the value in the csv, then re-import it again.