- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2016 12:20 PM
I have a normal business rule that takes a string value and writes it to another table, like so:
if(current.wf_activity.getDisplayValue() == 'Approver'){
updateSummarizer(current.sysapproval, 'Approval Comments', current.state + ' - ' + current.comments.getJournalEntry(-1), 190);
}
And then a function to do this:
function updateSummarizer(reqItem, label, value, order){
var summ = new GlideRecord('u_item_summary');
summ.initialize();
summ.u_request_item = reqItem;
summ.u_label = label;
summ.u_value = value;
summ.u_display_order = order;
summ.insert();
}
The issue I ran into is, if the current comments has a hyphen in it, the data gets inserted into my summary table truncated at that hyphen. They are both string fields, both set to 4000 chars, and if I don't use the hyphen, the comments get written across correctly. The comments get written to the sys_journal_field table correctly, just not my custom table.
This is all in the Global scope, so scoping is not an issue.
Any ideas as to what could be causing this truncation?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2016 03:55 PM
I tested it and it works for me when just printing out the value. Do you have any business rules on your custom table that could be clipping it based on the hyphen? I would add in a gs.log to see if the full value value string is getting created before putting it in the field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2016 03:55 PM
I tested it and it works for me when just printing out the value. Do you have any business rules on your custom table that could be clipping it based on the hyphen? I would add in a gs.log to see if the full value value string is getting created before putting it in the field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-02-2016 07:19 AM
You know when you do something stupid, and you cannot find your stupid thing, and you need someone to point you to that error? Well, that is exactly what happened here. I had a BR to scrub the date/time from the comment and replace it with GMT, and it was using hyphen as and array separator. Thanks for helping me find my stupid mistake.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-01-2016 04:16 PM
I know, Before Business rule is not a good idea, when you are dealing with other tables from the script but, have you tried that?
- if(current.wf_activity.getDisplayValue() == 'Approver'){
- updateSummarizer(current.sysapproval, 'Approval Comments', current.state + ' - ' + current.comments, 190);
- }
And then a function to do this:
- function updateSummarizer(reqItem, label, value, order){
- var summ = new GlideRecord('u_item_summary');
- summ.initialize();
- summ.u_request_item = reqItem;
- summ.u_label = label;
- summ.u_value = value;
- summ.u_display_order = order;
- summ.insert();
- }