user role check/add

madalinus1
Tera Contributor

Hello,

I need help with this task: 

I need to do a script to check that the inserted user has the 'user' role, I'll add it if it doesn't (Insert on sys_user_group)
if I add the role I send the user an email informing him that he has become a customer
I will add the current user in the salesperson field,
entry date will be valued with today's date

 

madalinus1_0-1705417670463.png

thanks for the help 

2 REPLIES 2

JaeggerLegane
Kilo Sage

Though this can be achieved with code for any role (not sure which user role you're referring to however), but you may want to instead consider flow designer for the less code savvy devs who need to maintain this in your team.

I had a similar use case recently but then to remove roles:

In flow designer:
1. Add a trigger on sys_user
2. Look up group member records where role is empty
3. For each item in records found in step 2
4. Update record
5. Add notification if needed


--------------------------------------------------------------------------------
If my post helped you, please click the accept solution button and hit the thumbs up! Thank you!

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @madalinus1 

 

What do you mean by User role? Is it custom role?

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************