CX Sales - How to retrieve primary BU name assigned to the login user with Groovy

Hi,

I'll cover how you can retrieve login user's information (e.g. Business Unit, Legal Entity) with Groovy. You may find it useful if you want to retrieve transaction data based on BU, stamp BU on your custom object, etc.

Here are the implementation steps,

1. Register HCM WSDL in App Composer 

https://URL/hcmService/UserDetailsServiceV2?WSDL


2. Call the above registered WS in groovy like below code

def response=adf.webServices.User.findUserDetailsByUsername('adamliu');

println(response[0].Value[0].UserWorkRelationshipDetails[0].BusinessUnitName);


Hope you find this post helpful, and stay healthy.


Thanks,

Adam Liu



Comments

Popular posts from this blog