How to print multiple variables' value to the description of target record in a record producer ?

1_DipikaD
Kilo Sage

Hi All,

 

How to print short description of record producer to the short description of target record in a Record producer.

Also want to print multiple variables value to the description of the target record one after another.

I tried the below script but still did not get the expected result :-

//(function executeRule(producer,current)
//{current.short_description = producer.short_description;})
var gr = current;
var shortdescription = gr.short_description;
gr.shortdescription = producer.short_description;
var des = producer.organization_name;
gr.description = " Organization Name :-" + des;
gr.description= des +"\nPoint of Contact at Third Party :-" + producer.point_of_contact_at_third_party;
gr.insert();
 
Thank you
1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@1_DipikaD 

short description of record producer means this?

AnkurBawiskar_0-1738299292500.png

 

If yes then you cannot access it using producer.short_description. You will have to hard-code it

current.short_description = 'Your Short Description \n' + 'Organization Name :-' + producer.organization_name + '\n' + 'Point of Contact at Third Party :-' + producer.point_of_contact_at_third_party;

If both the variables are reference type then use getDisplayValue() to get the display value rather than sysid

current.short_description = 'Your Short Description \n' + 'Organization Name :-' + producer.organization_name.getDisplayValue() + '\n' + 'Point of Contact at Third Party :-' + producer.point_of_contact_at_third_party.getDisplayValue();

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

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

View solution in original post

5 REPLIES 5

@1_DipikaD 

Hope you are doing good.

Did my reply answer your question?

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

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