AJAX problems with non-strings

 sometimes need to convert return parameters to STRINGS to avoid nulls


getItemPrice: function() { var sPrice = '0'; var sApproval = ''; var itemSYSID = this.getParameter('sysparm_catitem_sysid'); var returnItemObj = {}; // Declaring an object var grItem = new GlideRecord('sc_cat_item'); grItem.addQuery('sys_id', itemSYSID); grItem.query(); if (grItem.next()) { sPrice = grItem.price+""; sApproval = grItem.u_approval_type+""; } returnItemObj.price = sPrice; returnItemObj.approval = sApproval; returnItemObj.item = itemSYSID; return (JSON.stringify(returnItemObj)); },

Comments

Popular posts from this blog

GlideRecord setValue

variable advanced reference qualifier example

Running transform maps asynchronously