- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2017 10:33 AM
Looking for some help on this issue I'm running into. I can't seem to get data to write to the work notes field no transform.
Things I have tried:
- Mapping the source field to the target field of target.work_notes
- Tried a transform script as both onAfter and onBefore due to me needing to write this per record based on particular conditions. Code snippet below:
//Unmatched CI Behavior
(function runTransformScript(source, map, log, target) {
var ciLookup = new GlideRecord('cmdb_ci');
ciLookup.addQuery('name', '=', source.u_asset_names);
ciLookup.query();
var CI;
if(ciLookup.next()) {
//ignore
}
else {
CI = source.u_asset_names;
log.info("TEST: CI not found: " + CI); //Works and populates the CI variable
target.work_notes = CI;
target.u_hig_exception_justification = CI; //Works and populates the field.
}
})(source, map, log, target);
Also, to be clear, I have tried the following methods as well:
- target.work_notes.setValue(CI);
- target.work_notes.setJournalEntry(CI); This seems to break the remaining code as well, as I have the target.u_hig_exception_justification - CI; in there just for testing purposes.
Lastly, the code snippet above is working in its entirety ASIDE FROM the 'target.work_notes = CI;'
Any help would be greatly appreciated on this.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2017 11:51 AM
Okay, so... the following ended up being a working solution.
target.work_notes = CI.toString();
So, your idea of making it a string did work, but I had to do it with .toString();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2017 10:57 AM
Can you please try like:
target.work_notes = source.u_asset_names;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2017 11:00 AM
Hi Shishar, I actually had tried that as well, I forgot to add that to my post. This doesn't work either. But, if I were to do target.u_hig_exception_justification = source.u_asset_names; this works with no issues.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2017 11:00 AM
Hi Dustin,
Just a thought - have you tried with unchecking the 'run business rules' checkbox, just to make sure no business rules are overriding your work notes or something.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2017 11:01 AM
Hey Anudeep, I have not. Let me try that and get back to you! Thanks for the suggestion.