Question about Execute as Role in relation to a field update to a related record that is locked via workflow.
I have a User Event script that runs on a custom record. When a user updates the "name" field of the Customer PO Record (Custom) it will update the {otherrefnum} field on the related SO or invoice.
Currently Execute as Role is set to Current Role and even though users have edit/full access to the custom record I was expecting it to fail since the related invoice was locked via workflow. Is it simply because their role does have the rights to edit invoices in general that it ignores the LOCK Record action of the workflow?
e
erictgrubaugh
02/23/2024, 6:03 PM
Have you verified the locking Workflow even fires? If it's a User Event Workflow, I wouldn't expect it to get fired by a User Event script.
erictgrubaugh
02/23/2024, 6:04 PM
User Events (beforeLoad, beforeSubmit, afterSubmit) - whether Scripts or Workflows - do not chain or trigger each other
c
Chris
02/23/2024, 6:34 PM
ok that must be it. The approved state is locking the record on beforeload and the script doesn't trigger that.
Luckily it's doesn't appear to be a problem since any user who has access to the suitelet should be able to preform the functionality but I was just expecting to have to make it execute as admin. Thank you
✅ 1
z
Zoran R-DATAGRAM
02/24/2024, 12:21 PM
@erictgrubaugh did you test what's happening if we use workflow.initiate() in user events script? We know that workflow will not be initiated if record is created/updated in external user event, but how NerSuite handle script initiated workflow?