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.

Is it possible to modify an existing record through a record producer?

C_dric Chen
Tera Contributor

In the process of creating a menu item for an app that I'm developing for a school project, I came to the conclusion that I need to create a few user experiences before the service portal would lead me (or whom-ever I'm impersonating) to the correct page of the app.

However, since I designed my app to resemble a sign-in sheet, I made the app so that the correct way to use it would be modifying existing records instead of creating new records.

Now I have a question: Is it possible to modify an existing record through a record producer? Or, are record producers only capable of creating new records? If records producers cannot modify existing records, I might have to rebuild the app from scratch. ٩ (╬ʘ益ʘ╬) ۶

5 REPLIES 5

Kalaiarasan Pus
Giga Sage

You can update an existing record in a record producer. Just add current.setAbortAction(true) in your producer script section to abort creation of new record.

Thanks a lot! Would you mind giving this n00b an example on how to add this current.setAbortAction(true) to the script section? That would be greatly appreciated.

Example - https://community.servicenow.com/community?id=community_question&sys_id=29fe57d4db49681066f1d9d968961978

So I see these scripts in the example that you provided:

var value = producer.variableName;

if(present){

gs.addErrorMessage('You are not allowed to submit');

current.setAbortAction(true);

}

Should I simply copy and paste these codes into my record producer? Or should I modify anything in accordance with my app?

Thank you in advance.