I have a requirement to show Form section called self serv

Trupti Krishnam
Tera Contributor

I have a requirement to show Form section called 'self -serv' this Form Section to be shown when a Variable called Portfolio(reference field) on Demand table is set to 'MAC' if it is not set to MAC it should be hidden 

 

Since Portfolio is a Reference field i have written a system property to store it and then written it in a Display BR and called it in a Client Script

 

Client Script 

 if (g_scratchpad.isValid ) {
        g_form.setSectionDisply('selfserve_variables', true);
    } else {
        g_form.setSectionDisply('selfserve_variables', false);
    }
 
Display BR 
var gr = gs.getProperty('1234rrfvjdfghj');
g_scratchpad.isValid = gr
 
But it is not working Help me to achieve this Requirement
3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@Trupti Krishnam 

you are not comparing the field value

Update as this if it's a field

var gr = gs.getProperty('1234rrfvjdfghj');
g_scratchpad.isValid = current.demandField == gr;

update as this if it's a variable on your form

var gr = gs.getProperty('1234rrfvjdfghj');
g_scratchpad.isValid = current.variables.demandVariableName == gr;

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@Ankur Bawiskar 

it is not getting into else condition

even if the Portfolio is not MAC even then the section self serve is showing

@Trupti Krishnam 

So what debugging did you do?

what are the results of that debugging?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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