In Flow Designer, for order task i want to auto populate assign to field is current logged in user

nidhi40
Tera Contributor

Hi All, In Flow Designer, for order task i want to auto populate assign to field is current logged in user. any one help me on that.
Thanks

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@nidhi40 

Please discuss with your customer what do they mean by logged in user

are they referring to the user who raised the RITM?

if yes then do this

return fd_data.trigger.request_item.request.requested_for;

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

13 REPLIES 13

Yes Ankur I discussed with customer, requirement is 

 

For product order task is created assigned to field is auto populate current logged in user 

 

I used below code 

 

return gs.getUserDisplayName();

 

When I was open the execution details assign to name is showing but in order tasks assigned to field is showing empty.

@nidhi40 

where are you writing that script?

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

In flow designer While creating the order task action I selected Assigned to >scripted expand to edit in that iam writing the code

@nidhi40 

if you had a discussion with customer then what's the outcome

Who is the logged in user?

Because when flow runs it can run as system user or user who initiated the session

I already shared yesterday the point

are they referring to the user who raised the RITM?

if yes then do this

return fd_data.trigger.request_item.request.requested_for;

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

In flow designer While creating the order task action I selected Assigned to >scripted expand to edit in that iam writing the code. Outcome is current logged in user?who initiated the session