Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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.