can we use a record producer to create an incident using script

Shiva Kumar8
Kilo Guru

Hi Community,

is there a way I can create an incident using a record producer using script. if yes please help me.

Thanks.

1 ACCEPTED SOLUTION

Hi,

but why do you wish to populate variables?

User is not submitting record producer but having chat with VA

When submission happens via record producer then variables are populated

have a look on this for how to submit record producer via script; this might help you

How to Trigger change workflow/record producer from transform script

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

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

View solution in original post

13 REPLIES 13

Hi,

so what all information you are asking from user via VA?

that record producer must be having some variables; ask same information to user and create incident using script

Regards
Ankur

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

Hi Ankur, 

I'm creating incident using normal incident creation script below, Im able to populate few fields but not the variables, can you help me how yo pull the variables 

the variables are:

1. impact

2.please specify the application

3.description

(function execute() {
    var gr = new GlideRecord('incident');
		gr.initialize();
		gr.caller_id = gs.getUserID();
		gr.opened_by = gs.getUserID();		
		gr.short_description = vaInputs.description;
		gr.description = vaInputs.description;
		gr.business_service = "a8c4c649dbf94740b0463c9b7c961914";  
		gr.cmdb_ci = vaInputs.application;  
		gr.assignment_group = "0ae2acefdbce0f0067e1dd3b5e96199b";  
		gr.contact_type = "self-service";    
		gr.impact=vaInputs.impact; 
		gr.insert(); //insert the new record
})()

Hi,

but why do you wish to populate variables?

User is not submitting record producer but having chat with VA

When submission happens via record producer then variables are populated

have a look on this for how to submit record producer via script; this might help you

How to Trigger change workflow/record producer from transform script

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards
Ankur

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

@Shiva Kumar 

Hope you are doing good.

Did my reply answer your question?

If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.

Regards
Ankur

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

DanielCordick
Mega Patron
Mega Patron

Hey Shiva,

A record producer creates a ticket on any table you specify for the record producer, no need to create a script to do this

Record Producer | ServiceNow Docs

 

please mark helpful or correct 🙂