How to submit the Record producer using Script

ramesh_r
Mega Sage

Hi All,

Is this possible to submit the Record Producer from the script .? if ye kindly provide the sample script or any sample

 

 

Thanks

Ramesh R

 

 

1 ACCEPTED SOLUTION

Carlos Candano
Mega Guru

Hi Ramesh

Your Raw value needs to be enclosed inside the variables object.

ex. {'variables':{'description':'description','short_description':'short_description'}}

View solution in original post

14 REPLIES 14

@ramesh.r 

Hope you are doing good.

Did my reply answer your question?

If so, please mark appropriate response as correct & helpful so that the question will appear as resolved for others who may have a similar question in the future.

Thanks!
Ankur

 

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

Carlos Candano
Mega Guru

Hi Ramesh

Your Raw value needs to be enclosed inside the variables object.

ex. {'variables':{'description':'description','short_description':'short_description'}}

shallom
Tera Contributor

Hi Ramesh

if I understand you want to submit manual. I have been in the same pages. after some try and error I found this. 

I hope it helps you. you can use it client script on submit.

 

function onSubmit() {
    if (g_scratchpad.isFormValid) {
        return true;
    }
    var actionName = g_form.getActionName();
    if(some_condition_meet){
             g_scratchpad.isFormValid = true;
              g_form.submit(actionName);
       }
    return false;
};

 

Alex92
Tera Contributor

I got it working by using the CatItem API. Example from ServiceNow docs:

 

 

var catalogItem = new sn_sc.CatItem('3f1dd0320a0a0b99000a53f7604a2ef9'); //sys_id of the Create Incident record producer
var values = {
"variables": {"urgency" : "2", "comments" : "Laptop is in a brick state"},
"sysparm_id": "3f1dd0320a0a0b99000a53f7604a2ef9"
}
var targetRecordDetails = catalogItem.submitProducer(values);
gs.info(JSON.stringify(targetRecordDetails, null, 3));

 

 

Source: CatItem - Scoped

vDev
Tera Contributor

Any idea how to set Opened for, Opened by, Requested for fields in this catItem API? I am trying to create a case on HR core case table