I have a User Event script that runs on Create of ...
# general
e
I have a User Event script that runs on Create of Vendor Payments, for a subset of custom roles. For Payments created in the UI it runs fine. I have a Map/Reduce script that creates Vendor Payments. The Map/Reduce runs as Administrator, so my UE Script doesn't run. What's the best approach here to programmatically run the UE Script after the Map/Reduce?
a
Don't handle the execution roles via the UI but in code, then you will be able to do something like: if (one of these roles OR execution context is Map Reduce) { run. }
e
The UE Script comes from a Localization Bundle, can't touch it 😕
a
In that case, second deployment for the Map Reduce to run as one of the roles that trigger that UE.
e
In Map/Reduce, the option of
EXECUTE AS ROLE
is locked as Administrator, can't be changed
a
So you can't update the MR or the UE?
e
Correct. The user needs to edit > save the records manually to trigger the UE.
I was thinking of CSV Imports, Mass Update, Workflows, etc. to trigger the UE
a
Well if you can't update the MR or UE, not event the deployment, then you are going to need to do something trickier... Write a MR or Scheduled script that searches those records System Notes to determine if they were modified by a MR, then load and save, since this is a Map Reduce or Scheduled created by you, then you can make it run as the role you need.
e
It's by design. As per Oracle docs: For map/reduce deployments, this value is automatically set to Administrator and cannot be edited. For scheduled script deployments, this value is automatically set to Administrator and cannot be edited.
a
It was not like that before... Then go more crazy: Map Reduce or Scheduled Script -> Suitelet -> Your record. But you may be able to do custom Mass Update.
e
Thanks @alien4u