Posts

Showing posts from February, 2024

How to get a parameter from the URL - Catalog Client Script

      The mission was to get a sys_id from the URL, query a record and return a value to the front-end.       In the front-end we have a Record Producer (RP) with a String field.       On the onLoad event, we want to populate the field in order to show the value retrieved from the back-end.       The scenario is defined so let's go to the step by step process. 1. Create a Util class in the back-end       Our  Utils  class will be a Script Include that receives a sys_id and returns a String.   var KMXOUtils = Class.create(); KMXOUtils.prototype = { initialize: function() { }, /* * Receives a um sys_id and returns a Task table field value * * @param {String} - taskId * @return {Object} */ getTaskNumber: function(taskId) { if (taskId != "" && taskId != null && taskId != undefined) { var grTask = new GlideRecord('x_770214_consultor_rwd_activity'); if (grTask.get(taskId)) { var number