populating unexpected value (question mark symbol ?) in string value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2024 01:36 AM
Hi everyone
We have a string field highlighted in screenshot where we are populating some value based on calculation, but for few records it is showing question mark(?) symbol in that field. What could be the reason..Please see screenshot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2024 06:47 AM
is this happening with only this string field? is this an OOB field or custom one?
I think some random characters i.e. non-ascii one is getting populated and some script is overriding it with correct value expected in string field
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2024 12:18 PM
Hi Ankur
this is custom string field, I checked other scripts and can not see anywhere overridden
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2024 04:26 AM
This business rule running on u_imt_incident table in servicenow (function executeRule(current, previous /*null when async*/ ) {
// Add your code here
// if (current.parent_incident) {
var query = 'parent_incident=' + current.parent_incident.sys_id + '^ORsys_idSTARTSWITH' + current.parent_incident;
var parentIMT = new GlideRecord('u_imt_incident');
if (parentIMT.get(current.parent_incident)) {
// initialize total amount.
var totalAdjustment = 0;
//Query all child IMT incidents for parent
var childIMT = new GlideAggregate('u_imt_incident');
//childIMT.addQuery('parent_incident',parentIMT.sys_id);
childIMT.addEncodedQuery(query);
childIMT.setGroup(false);
childIMT.addAggregate('SUM', 'u_finance_adjustment_processed');
childIMT.query();
while (childIMT.next()) {
totalAdjustment = childIMT.getAggregate('SUM', 'u_finance_adjustment_processed');
gs.info("totalAdjustment "+totalAdjustment);
}
var test = sn_i18n.NumberFormatter.format(parseFloat(totalAdjustment).toFixed(2));
gs.info("finalLog "+sn_i18n.NumberFormatter.format(Number(parseFloat(totalAdjustment).toFixed(2))));
parentIMT.u_trend_theme_3_other = sn_i18n.NumberFormatter.format(Number(parseFloat(totalAdjustment).toFixed(2)));
parentIMT.update();
}
// }
})(current, previous); but � is getting populated in u_trend_theme_3_other field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2024 11:35 PM
Hi @Ankur Bawiskar This is the only Business rule running on insert/update on that custom field, but no sure if this causing the issue
(function executeRule(current, previous /*null when async*/ ) {
// Add your code here
// if (current.parent_incident) {
var query = 'parent_incident=' + current.parent_incident.sys_id + '^ORsys_idSTARTSWITH' + current.parent_incident;
var parentIMT = new GlideRecord('u_imt_incident');
if (parentIMT.get(current.parent_incident)) {
// initialize total amount.
var totalAdjustment = 0;
//Query all child IMT incidents for parent
var childIMT = new GlideAggregate('u_imt_incident');
//childIMT.addQuery('parent_incident',parentIMT.sys_id);
childIMT.addEncodedQuery(query);
childIMT.setGroup(false);
childIMT.addAggregate('SUM', 'u_finance_adjustment_processed');
childIMT.query();
while (childIMT.next()) {
totalAdjustment = childIMT.getAggregate('SUM', 'u_finance_adjustment_processed');
gs.info("totalAdjustment "+totalAdjustment);
}
var test = sn_i18n.NumberFormatter.format(parseFloat(totalAdjustment).toFixed(2));
gs.info("finalLog "+sn_i18n.NumberFormatter.format(Number(parseFloat(totalAdjustment).toFixed(2))));
parentIMT.u_trend_theme_3_other = sn_i18n.NumberFormatter.format(Number(parseFloat(totalAdjustment).toFixed(2)));
parentIMT.update();
}
// }
})(current, previous);