We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

DOM alternative

pswapnil320
Tera Contributor

Can anyone suggest replacement functions for DOM manipulation technique (e.g. gel, document) in Client script.

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
     g_form.getReference('u_source_cost_center', applyCostCenterStyle);

    function applyCostCenterStyle(cost_center) {
        if (cost_center.u_active == 'true')
            return;
        try {
            var elementID = gel('sys_display.' + g_form.getTableName() + '.' + 'u_source_cost_center');
            elementID.style.color = "red";
        } catch (ex) {}
    }
}

 

0 REPLIES 0