getBooleanValue is not returning correct value

Al-jhon
Kilo Sage

I created a Variable set with a reference type variable.
The variable New Approver (new_approver) is hidden and i want to set it mandatory and visible in RITM and SCTASK form when the flow detected that the approver is not active anymore.

but i cannot achieve it by using catalog UI policy in the variable set:

 

Aljhon_1-1686711578081.png

the alert always returning false or maybe the getBooleanValue is undefined that's why it always return false.

Can anyone help me with my script?

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Al-jhon 

you cannot dot walk 2 levels in client script.

you better use GlideAjax and get the active field value using Script Include and then do the needful

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

View solution in original post

4 REPLIES 4

Al-jhon
Kilo Sage

If i change my scrip into:
var getStats = g_form.getDisplayValue('requested_for.manager.active');
alert(getStats);

It returning the RITM Number.

Ankur Bawiskar
Tera Patron
Tera Patron

@Al-jhon 

you cannot dot walk 2 levels in client script.

you better use GlideAjax and get the active field value using Script Include and then do the needful

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

Tony Chatfield1
Kilo Patron

Hi, I would recommend that you follow Ankur Bawiskars suggestions, and the unexpected results of your 'changed' script test for display value should confirm his post is correct.
Also in your code you were testing a boolean value as a string IE 'true'

so even if the correct value had been returned and assigned to your variable, you would still not have correct functionality in your code. 

 

Al-jhon
Kilo Sage

Hello @Ankur Bawiskar and @Tony Chatfield1 thank you for the idea.
Actually i did this method on my PDI but i din't give any value but upon applying this one on our DEV instance it WORKED! 

Thank you so much! I achieved this via GlideAjax

Aljhon_0-1686719564575.png

 

Aljhon_1-1686719578931.png