Hi There
I have a map reduce script that is triggered from a task.submit on a workflow action script.
The execution of the scripts works as follows:
1 A 'create invoice' button is added to a sales order record with a workflow action
2 once the button is pressed, the workflow moves to a state where a workflow action script is triggered
3 The workflow action script uses the N/task module to trigger a map reduce script
The map reduce script can only be executed as an administrator
The issue with this is that, roles which do not have permissions to create invoices (which is what the map reduce script does), can do so because of the set up of the workflow and the scripts.
a. Is there a way to only run the map reduce script if the user has the permissions needed for the underlying transactions? (create invoices permissions in this case)?
b. If a.), is not possible, is there a way to restrict the appearance of the 'create invoice' button on the workflow so that it only appears for anyone with the transactions>invoice>create permission?
I can 'hard code' the roles this button appears for by adjusting the conditions:
However, I want this to be dynamic and not based on a set list of roles.
Instead, I want it to be driven by whether the user has the specific permission required.
Thanks