- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2019 08:38 AM
Good morning everyone,
I'm trying to write a business rule that updates the Comments (Customer Visible) field with the information provided in the Close Notes field once the technician decides to resolve the ticket. I know this information can be seen in the Activity, however, I need the Comments field to be updated with the Close Notes field for my organization. I have provided a copy of my script, which should be simple but I'm having some trouble. The script is on the Incident table and runs on an update after Close Notes is not empty (I think that's correct):
(function executeRule(current, previous /*null when async*/) {
current.comments = current.close_notes.getDisplayValue();
})(current, previous);
Any help will be greatly appreciated!
Best regards,
cnharris
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2019 02:05 PM
Thanks Prateek! I tried using the code and it does work but it just doesn't work on the comments field for some reason. I think it has something to do with that field being an array but I'm not too certain. I did find a workaround to my problem and I provided the link below:
https://community.servicenow.com/community?id=community_question&sys_id=9997c7a9db1cdbc01dcaf3231f961933&view_source=searchResult

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2019 09:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2019 09:04 AM
Yes sir, it is a business rule and I have the update field set to true.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2019 09:12 AM
I don't see anything wrong in the script. There might be a rule that is stopping this from execution.
Check if there is any setWorkflow(false) in any of the business rules on incident table.
Also, can you try by adding some log statements or addInfoMessage to see whether it is running or not
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2019 02:08 PM
Thanks dvp,
I checked and I didn't have anything that would prevent the rule from running. The code does work because I used it on a different field but for some reason, I couldn't get the comments to work. I did find a workaround to my problem...I provided the link below:
https://community.servicenow.com/community?id=community_question&sys_id=9997c7a9db1cdbc01dcaf3231f961933&view_source=searchResult