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.

Record producer is creating new user in user table

Vijay Kummamuru
Tera Contributor

I am trying to send data from  record producer to employee table and it is creating new user although i select the existing user from sys_user table - it is giving " primary email device created" message . Below are the screenshots of configurations 

 

Record Producer

VijayKummamuru_0-1719297462016.png

Requested For variable 

VijayKummamuru_1-1719297502493.png

 

 

Employee form to which we need to send data 

 

VijayKummamuru_2-1719297638664.png

 

VijayKummamuru_3-1719297679422.png

 

 

#record producer # Service catalog @SNlearner @Ankur Bawiskar @SN_Learn 

 

 

 

 

 

 

 

3 REPLIES 3

Yashsvi
Kilo Sage

Hi @Vijay Kummamuru,

please check below link:

https://www.servicenow.com/community/developer-forum/user-creation-through-record-producer/m-p/19472...

Thank you, please make helpful if you accept the solution.

Ankur Bawiskar
Tera Patron
Tera Patron

@Vijay Kummamuru 

record producers are meant for record creation on target table.

please share complete business requirement here

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

SN_Learn
Kilo Patron
Kilo Patron

Hi @Vijay Kummamuru ,

 

When you submit the record producer it is expected behavior to create/insert record on the table selected in the record producer.

 

If you want to update the record rather than insert/create. You can try the below script in the script part of Record producer:

 

var getReqID = producer.u_requested_by; //Replace the field name

var updateEmpDetails = new GlideRecord('sys_user');
updateEmpDetails.addQuery('sys_id', getReqID);
updateEmpDetails.query();
if (updateEmpDetails.next()) {
updateEmpDetails.first_name = producer.firstName; //replace with correct name
updateEmpDetails.last_name = producer.lastName; //replace with correct name
updateEmpDetails.manager = producer.manager; //replace with correct name
updateEmpDetails.update();
current.setAbortAction(true); //This will prevent the insert/creation of new record

}

 

Mark this as Helpful / Accept the Solution if this helps

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.