Flow Designer - Update Record Action - Change who updates records/ Run-as option?

iverduzco
Tera Expert

In Flow Designer, is it possible to change who performs the update record actions? In my instance i want all the scheduled job update record actions to be performed by system administrator instead of myself. Ive attempted to use "updated by" field in the update actions to system admin but it still logs all my changes in the activity flow as myself. 

1 ACCEPTED SOLUTION

Unfortunately thats not available in the out of the box update action in Flow Designer. 

Fortunately i figured it out with a workaround!

I created two Actions in flow designer

RunAsAdmin Start and RunAsAdmin End

RunAsAdmin Start has no input variables, created 1 output variable; sysUser with a string parameter

it just has a script step

(function execute(inputs, outputs) {
        //impersonate system admin
	var runAdmin = gs.getSession().impersonate('98b039ef0a0a3d2800b10b5352f375eb');
  	outputs.sysUser = runAdmin; 
})(inputs, outputs);

after this action, i ran my update record action followed by RunAsAdmin End

I used the output.sysUser data pill as an input variable, sysUser with string parameter

(function execute(inputs, outputs) {
        //return to previous user context
	gs.getSession().impersonate(inputs.sysUser);
})(inputs, outputs);

 I just ran and tested this and worked as i hoped for. I will continue to test to see if it breaks in anyway. 

View solution in original post

8 REPLIES 8

I'm trying to do this, and every time the flow errors "The requested flow operation was prohibited by security rules."

 

ive tried to run as system user, ive tried running as original user and under roles giving impersonator.  but nothing seems to be working to allow an impersonation to update a ticket, i need this for worknotes to be put in by a specific user.

Warlocket
Kilo Explorer

Your information is very interesting. Thank you for sharing publix oasis

rmmahilum
Giga Contributor


Followed and created two Actions in flow designer RunAsAdmin Start and RunAsAdmin End
but encountered this error:

{
    "Action Status": {
        "code": 1,
        "message": "Error: Cannot find function impersonate in object com.glide.script.fencing.ScopedGlideSession@305f8c.,Detail: Cannot find function impersonate in object com.glide.script.fencing.ScopedGlideSession@305f8c."
    }
}



 

Sathiskumar_D
Giga Sage

@iverduzco Thanks for posting your solution. I tried your code. I got a question.

 

in the second action, what is the "input.sysuser"? How sys admin is un-impersonating and roll back as system user?