- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2023 11:36 PM
Hello,
I want to update script on record producer so that only the fields that are filled in get copied to the technician worknotes
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2023 11:53 PM
Hi @Andrew Kimani,
You need to use the producer scripts and add the non-empty variables to work notes.
var strComments = "";
if(producer.variable_name != ""){
strComments += producer.variable_name;
}
if(producer.variable_name1 != ""){
strComments += producer.variable_name1 + "\n";
}
if(producer.variable_name2 != ""){
strComments += producer.variable_name2 + "\n";
}
if(producer.variable_name3 != ""){
strComments += producer.variable_name3 + "\n";
}
.
.
.
.
so on...
current.work_notes = strComments;
If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2023 11:51 PM
Hello @Andrew Kimani
Greetings!
You have to write insert BR script for this
refer below threads:
https://www.servicenow.com/community/developer-forum/copy-variables-to-work-notes/m-p/1992735
Please hit the thumb and Mark as correct based on Impact!!
Kind Regards,
Ravi Chandra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2023 11:53 PM
Hi @Andrew Kimani,
You need to use the producer scripts and add the non-empty variables to work notes.
var strComments = "";
if(producer.variable_name != ""){
strComments += producer.variable_name;
}
if(producer.variable_name1 != ""){
strComments += producer.variable_name1 + "\n";
}
if(producer.variable_name2 != ""){
strComments += producer.variable_name2 + "\n";
}
if(producer.variable_name3 != ""){
strComments += producer.variable_name3 + "\n";
}
.
.
.
.
so on...
current.work_notes = strComments;
If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers.
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2025 10:04 PM
I think you can assign it straight to work_notes field. Provided only one field is getting captured.