Need to copy catalog variables input to incident description in servicenow

Vani14
Tera Contributor

Need to copy catalog variables input to incident description in ServiceNow

1 ACCEPTED SOLUTION

Jyoti Jadhav9
Tera Guru

Hi @Vani14 ,

Could you please explain the use case in detail?

If you have created a record producer for an incident table then you can access the value of the variables using "producer.variable_name". Please see the below script that you can try in the script field of record producer:

Record producer script:

var fn = producer.first_name;
var ln = producer.last_name;
var caller = producer.caller_id.getDisplayValue();
current.description = 'FirstName:- ' + fn + '\n' +
'LastName:- ' + ln + '\n' +
'Caller:- ' + caller;
current.short_description = fn + '/' + ln + '/' + caller;
 
O/P:
Jyoti4_0-1704628066949.png

 

 

Please hit the like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.

 

Thanks & Regards

Jyoti Jadhav

 

 

View solution in original post

4 REPLIES 4

Community Alums
Not applicable

Kristen Ankeny
Kilo Sage

If you mean that you have a record producer that creates an incident, then you can use the "script" field on the record producer to populate the created incident's description with variables on the record producer. This doc page explains how to get to the variable values and how to reference the created record: https://docs.servicenow.com/bundle/vancouver-servicenow-platform/page/product/service-catalog-manage...

 

ersureshbe
Giga Sage
Giga Sage

Hi, You can define the script in workflow using current.variables.variable_name and write server script like below.

var ga = new GlideRecord('incident');

ga.initialize();

ga.description = current.variables.variable_name;

ga.insert();

Regards,
Suresh.

Jyoti Jadhav9
Tera Guru

Hi @Vani14 ,

Could you please explain the use case in detail?

If you have created a record producer for an incident table then you can access the value of the variables using "producer.variable_name". Please see the below script that you can try in the script field of record producer:

Record producer script:

var fn = producer.first_name;
var ln = producer.last_name;
var caller = producer.caller_id.getDisplayValue();
current.description = 'FirstName:- ' + fn + '\n' +
'LastName:- ' + ln + '\n' +
'Caller:- ' + caller;
current.short_description = fn + '/' + ln + '/' + caller;
 
O/P:
Jyoti4_0-1704628066949.png

 

 

Please hit the like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.

 

Thanks & Regards

Jyoti Jadhav