Hide Empty Variables in RITM and Task

Santhosh23
Tera Expert

Hi All,

I am working in service catalog. after submitting the service catalog i want to display only the variables which is available on the form view. I wrote some UI policy to hide some fields based on conditions.

But in RITM and Task all variables is showing including empty variablles. could you please help me on this.

 

 

11 REPLIES 11

Hi Santhosh,

Did you try to print the variables in array?

gs.info('Variables is: ' + emptyVars);

Regards
Ankur

 

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Santhosh 

Hope you are doing good.

Did my reply answer your question?

If so, please mark appropriate response as correct & helpful so that the question will appear as resolved for others who may have a similar question in the future.

Thanks!
Ankur

 

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Santhosh 

Hope you are doing good.

Did my reply answer your question?

If my response helped you please mark it correct to close the question so that it benefits future readers as well.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Anil Shewale
Mega Guru

Hi

OnLoad  Client script to hide Variables (a copy of this exists within the task, sc_req_item, and sc_task tables):

 

function onLoad() {

    //Hide all empty variables using the scratchpad object passed from 'Hide Empty Variables' business rule

    if(g_scratchpad.emptyVars != ''){

          var emptyVars = g_scratchpad.emptyVars.split(',');

          for(i = 0; i < emptyVars.length; i++){

                g_form.setDisplay('variables.' + emptyVars[i], false);

          }

    }

}

If it help mark helpful or correct 

Thanks and regards

Anil

Hi Anil, Yes, I have wrote this in ritm and sc task table. It is filtering empty value but still unchecked checkbox is visible.