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.

How to include record producer variables into Incident Description field

Renu9
Tera Contributor

Hi All,

I m using record producer to create an Incident record.

There are 4 variables in my record producer where I need to include all these variable questions with answers into the Incident record Description field.

Could you please guide me how can this be achieved?

 

 

Variables in Record producer:

1. Date of issue

2.Time of Issue

3.How many users affected

4. Required Information

 

I want the description field to appear in the Incident form something like this:

 

Below are the details

1. Date of issue : 17-10-2023

2.Time of Issue: 10 CET

3.How many users affected: 2

4. Required Information : Test

2 ACCEPTED SOLUTIONS

Jaspal Singh
Mega Patron
Mega Patron

Hi Renu,

In the Record producer for the Incident you can try adding something as below to the Entitlement script

var dateis=producer.date_of_issue;//replace the variabledate_of_issue name accordingly
var timeis=producer.tiem_of_isse;//replace the variable time_of_issue name accordingly
//so and and so forth for other variables
current.description=dateis+' '+timeis;

 

View solution in original post

Harsh_Deep
Giga Sage
Giga Sage

Hi @Renu9 ,

 

In the Record producer for the Incident you can try adding below script in producer script

var date=producer.date_of_issue;//replace the variabledate_of_issue name accordingly
var time=producer.time_of_isse;//replace the variable time_of_issue name accordingly
var affectedUsers=producer.how_many_users_affected;//replace the variable how_many_users_affected name accordingly
var requiredInfo=producer.required_information;//replace the variable required_information name accordingly
current.description=date+' '+time+' '+affectedUsers+' '+requiredInfo;

 

Please be sure to bookmark this article as well as mark it as Helpful if you thought it was helpful.

 

View solution in original post

5 REPLIES 5

swathisarang98
Giga Sage

Hi @Renu9 ,

 

You can write the below code in the record producer script,

 

 

 

var date=producer.u_date; //"producer.<backend name>"  please add your field backend name (for all 4 fields)
var time=producer.u_time; 
var userAffected=producer.useraffected;
var requiredInfo=producer.info;
current.description ='1.Date of issue : '+date+'\n 2.Time of Issue: '+time+'\n 3.How many users affected: '+userAffected+'\n 4.Required Information : '+requiredInfo;

 

 

 

 

Output:

Record producer script.PNG

Please check and Mark Helpful and Correct if it really helps you.

Regards,

Swathi Sarang