How to create an incident from record producer through virtual agent?

Community Alums
Not applicable

I want to create an incident with variable section through virtual agent, the same way we create through record producer.

I tried the the way by which we create RITMs but it's not working.

1 ACCEPTED SOLUTION

Several ways possible. Also depending on where the information for those variables would come from.

Though, easiest would be to add a question_answer record scripted. Like below. This would already be similar as having variables when submitted through a record producer.

Personally I would consider doing this more dynamically, fetching the variables from the record producer, etc.. Though below would already work.

var grAnswer = new GlideRecord('question_answer');
grAnswer.initialize();
grAnswer.setValue('table_name', 'incident');
grAnswer.setValue('table_sys_id', 'sys_id_of_your_created_incident, maybe something like vaInputs.create_incident');
grAnswer.setValue('question', 'sys_id_of_the_variable');
grAnswer.setValue('value', 'value_for_the_variable');
grAnswer.setValue('order', '100/200/300/etc');
grAnswer.insert();

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

View solution in original post

9 REPLIES 9

Several ways possible. Also depending on where the information for those variables would come from.

Though, easiest would be to add a question_answer record scripted. Like below. This would already be similar as having variables when submitted through a record producer.

Personally I would consider doing this more dynamically, fetching the variables from the record producer, etc.. Though below would already work.

var grAnswer = new GlideRecord('question_answer');
grAnswer.initialize();
grAnswer.setValue('table_name', 'incident');
grAnswer.setValue('table_sys_id', 'sys_id_of_your_created_incident, maybe something like vaInputs.create_incident');
grAnswer.setValue('question', 'sys_id_of_the_variable');
grAnswer.setValue('value', 'value_for_the_variable');
grAnswer.setValue('order', '100/200/300/etc');
grAnswer.insert();

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Community Alums
Not applicable

Thank you so much Mark

Thank you Mark for the details.

I am still unable to create a Incident record with the Variables.

I have Catalog Item and Custom Form has been created on ServiceNow to create the request Ticket for this Item.

I am Trying to utilize those variables from Virtual agent to submit the request.

I tried to set values for the questions in Incident Table but It did not worked.

I am using Quebec..

Hi,

Is there a way to create an Incident using a Record producer? Populate the variables dynamically on the Record Producer and re-use the Record Producer script held within the Record producer? Don't want to replicate the logic within the Record producer inside my VA topic

 

Regards,

Ayman