Retrieve current customer from database

0
Hello In a domain model like this :   When trying to retrieve the current customer (current user) from database in a microflow, what is difference between [OrderManagement.Customer_Account/Administration.Account/id='[%CurrentUser%]'] and [OrderManagement.Customer_Account='[%CurrentUser%]'] I think that both return the correct answer but is there a difference between the 2 ways to write?    Thank you  
asked
2 answers
1

Hi Audelia Zeitoun,

 

we can write the xpath in both conditions as you mentioned, you retrieve the same data by using any query.

 

But In Advance learning, we get to know that for xpath optimization we'll write this as "Current user will be compared to the association" instead of comparing to the id of the account entity.

 

So for xpath optimization, we go for "[OrderManagement.Customer_Account='[%CurrentUser%]']"  in your case.

 

Regards,

Bhargav Ram Singh Bondili

answered
1

Hi Audelia,

 

The only difference between both is that if you need something specific in any case to use the ID you can reach to it, otherwise in terms of performance it is recommended to use only the association like this [OrderManagement.Customer_Account='[%CurrentUser%]'] in the mentioned case to guarantee the best performance

 

Best of luck!

answered