The CreatorCon Call for Content is officially open! Get started here.

How do I add admin role to user using flow designer?

_Yash24
Tera Guru

Hi Team,

 

I have requirement to create catalog item where I need to grant admin access for 24 hours to user after managers approval.

I have created flow by using below steps but its not assigning role to user, I'm not sure if these are correct or not but its not working.

1.Trigger -> service catalog

2.Action -> Get catalog variables

3.Ask for approval 

 If approved 

4.Create Record -> sys_user_has_role

5.wait for condition -> 24 hours

6.Delete record -> After 24 hours it should be deleted.

 

flow is getting completed but admin access is not assigned to user.

 

Can someone help me to design the flow designer?

2 REPLIES 2

Mark Manders
Mega Patron

How does it run? If you run it as user initiating, it won't work, because only an admin can grant admin rights.

Next to that: create a group for this, with the admin role in it, so you can create the sys_user_grmember record and delete it. This way you will use best practices and it's easy to find everyone that has this temp role setting.

And, if you are on Washington on later, use the OOB feature: https://www.servicenow.com/community/developer-forum/time-limited-user-roles/td-p/2813236

 

 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Sandeep Rajput
Tera Patron
Tera Patron

@_Yash24 If you are already on Washington release then you can use OOTB Time Limited User role feature https://docs.servicenow.com/bundle/washingtondc-platform-administration/page/administer/roles/concep...