How to input values of fields inside Description of an incident?

Mouktik_B
Tera Contributor

I am filling up the values of fields while raising an incident and then I want to see few of those field values inside description of an incident form. 
Please assist. 

12 REPLIES 12

Musab Rasheed
Tera Sage
Tera Sage

You can easily do this, for example if you have record producer then you can write below code.

current.description = producer.variable_name1 + "\n" + producer.variable_name2

Write something like this in Record producer script. if it is for creation from incident form then write something like above in before Business rule and in that instead of using producer you can use current with field name.

Please hit like and mark my response as correct if that helps
Regards,
Musab

@Mouktik_B Thanks for marking my response as helpful, I see I have provided you sample code, simply write this in record producer script with proper variable names and it will work.

current.description = producer.variable_name1 + "\n" + producer.variable_name2+ "\n" + producer.variable_name3;

Please hit like and mark my response as correct if that helps
Regards,
Musab

Ehab Pilloor
Mega Sage

Hi, 

you can use business rule to add fields to description using glide record on incident. 

ex: 

gr = new GlideRecord('incident');

current.description = current.description + "\n" + "Caller -" + current.callerID + "\n" + "State - " + current.state;

current.update();

 

Please note this is a snippet showing logic of your requirements and you will need to make changes.

If you found this helpful, please mark this reply as solution.

 

Thanks and Regards,

Ehab Pilloor

Rajdeep Ganguly
Mega Guru

Sure, you can achieve this by using a Business Rule in ServiceNow. Here are the steps: 1. Navigate to System Definition > Business Rules. 2. Click on New to create a new business rule. 3. Fill in the necessary fields: - Name: Give a meaningful name to the business rule. - Table: Select the Incident table. - When: Select "before". - Insert: Check this box. - Update: Check this box. 4. In the "Advanced" tab, write a script to concatenate the values of the fields you want to see in the description. Here is a sample script: javascript (function executeRule(current, previous /*null when async*/) { // Concatenate the values of the fields you want to see in the description var field1 = current.field1; var field2 = current.field2; var field3 = current.field3; // Set the description field current.description = 'Field1: ' + field1 + ', Field2: ' + field2 + ', Field3: ' + field3; })(current, previous); 5. Replace "field1", "field2", and "field3" with the actual field names you want to include in the description. 6. Click on Submit to save the business rule. Now, whenever an incident is created or updated, the description field will be automatically filled with the values of the specified fields.

Great response . 
The customer comes up as a sys Id and not the name , any solution for that?