on 2020 Feb 24 1:17 PM
Hi there,
we have implemented our validation logic for address by enhancing the BO AddressSnapshot. It will prevent saving an address if the address input by user is not valid.
But now we do not want to execute this part of logic in case of replication of an account from ERP to C4C, because It will make the replication failed.
However , I have no idea how to check if the current processing is triggered by a replication or just data inputing of user.
Is there any global or system variable like sy-uname in ABAP world ?
Can any one give some ideas ?
Thank you
Peter
Hi,
You can identify if a use is manually changing or changes are done by a integraion user by very simple piece of code.
import AP.PC.IdentityManagement.Global;
var ident = Identity.Retrieve(Context.GetCurrentIdentityUUID());
if (ident.BusinessPartnerUUID.IsInitial()) // It is a technical User
{
// Write Business Logic
}
else // Manual change
{
// Write Another Business Logic
}
Here we are just checking if the BP UUID of the user is initial or not. If it is initial then it is a technical user (Integration user based change) else it is a Service Agent or Employee(Manual change).
Thanks
Saurabh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Peter,
with the Context ReuseLibrary you can get the user details, who is doing a change and triggering the script. If that's a UI user you'll find an employee for that Identity which Context gives you.
Hope that helps, Michael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Michael,
thank you for your quick answer.
so it means that I will use the following code to get the current employee who is triggering the current script.
var cur_user =Context.GetCurrentIdentityUUID();
var emp = Employee.Retrieve(cur_user);
On the other hand, the variable emp will be initial, if the script is triggered by replication.
Am I right?
Best wishes
Peter
User | Count |
---|---|
81 | |
10 | |
10 | |
10 | |
10 | |
9 | |
8 | |
7 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.