We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

How to create new user via catalog item and workflow?

patrycjabak
Tera Contributor

As above, i want automate adding users. How to do it ?

I have created variables in catalog item and i added workflow with script
how can i put button "create" or somenting similiar?
servicerequestcatalog.png

workflow2.png

3 REPLIES 3

Gowrisankar Sat
Tera Guru

Insert



var rec = new GlideRecord('user');


rec.initialize();


rec.first_name = current.variables.<firstname_Variable>;


rec.last_name = current.variables.<lastname_Variable>;


rec.company = current.variables.<company_Variablename>;


rec.insert();


But how to make it live ?
Is there any way to make button create ?
its new for me


Use the above script in Run script.



Best Practice:   Use rec.newRecord() instead rec.initialize(); in the above code.