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 update request variable field values in change description servicenow

sunil kumar11
Tera Expert

I have record producer for change table. When I submit the form the request details should update on change request - description field.

 

sunilkumar11_0-1707921785948.png

 

@shyam10

2 ACCEPTED SOLUTIONS

kps sumanth
Mega Guru

Hello @sunil kumar11 ,

 

You can write your record producer script as below,

 

var desc = '

\n Source Database Instance CI : ' + producer.corresponding variablename+'\n Source MSSQL DB  ORACLE Schema : '+ producer.corresponding variable name + like this add all the 6 variables and in the end add current.description = desc;

View solution in original post

Yeah you could do something like.

current.description = 'Source MSSQL DB: ' + producer.mssql_variable + '\n';
current.description += 'Hostname: ' + producer.hostname_variable+ '\n';
current.description += 'Source Environment: ' + producer.source_env_variable+ '\n';

And so on.

View solution in original post

9 REPLIES 9

Hi @kps sumanth 

 

I need to  get only 6 fields to shown in the description as you can see the screenshot which i have shared

Yeah you could do something like.

current.description = 'Source MSSQL DB: ' + producer.mssql_variable + '\n';
current.description += 'Hostname: ' + producer.hostname_variable+ '\n';
current.description += 'Source Environment: ' + producer.source_env_variable+ '\n';

And so on.

Hi @The Machine @kps sumanth 

 

Great its working 🙂

only 1 doubt here . SYS ID is getting instead of CI name

 

Source Database Instance CI: c57ee6e3db8a4094a7c09635db961951

 

sunilkumar11_0-1707979588582.png

 

Add .getDisplayValue() to the end of producer.variable_name for any reference fields.

producer.ci_name.getDisplayValue()

kps sumanth
Mega Guru

Hello @sunil kumar11 ,

 

You can write your record producer script as below,

 

var desc = '

\n Source Database Instance CI : ' + producer.corresponding variablename+'\n Source MSSQL DB  ORACLE Schema : '+ producer.corresponding variable name + like this add all the 6 variables and in the end add current.description = desc;