We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Adding variable text to short description on record producer

riskay123
Mega Guru

Good Afternoon,

I am trying to add text to the short description on a record producer. It is a combination of some static text and the value of a a variable on the record producer and I am having a bit of trouble.

The short description should display "Printer Fault" + the value of a variable. 

The variable name in this example is "machine_number"

I have added a script current.short_description = "Printer Fault - " + current.variables.machine_number;

When the record is created the short description display "Printer Fault - undefined".

Can someone please tell me what is wrong here?

Thanks

 

1 ACCEPTED SOLUTION

Jaspal Singh
Mega Patron

Hi,

Assuming you are passing above in record producer script you need to replace current with producer. So,

current.short_description = "Printer Fault - " + current.variables.machine_number; 

should be

current.short_description = "Printer Fault - " + producer.machine_number;

View solution in original post

4 REPLIES 4

Jaspal Singh
Mega Patron

Hi,

Assuming you are passing above in record producer script you need to replace current with producer. So,

current.short_description = "Printer Fault - " + current.variables.machine_number; 

should be

current.short_description = "Printer Fault - " + producer.machine_number;

Thank you. 

And you can get the text (display value) with the following code:

current.short_description = "Printer Fault - " + producer.machine_number.getDisplayValue();

 

riskay123
Mega Guru

Thanks so much. This fixed the issue.