g_form.getControl() not working in Service Portal in Catalog Client Script

gaurip
Mega Expert

Hi all,

I'm working on Helsinki Service Portal.

'resolving_change' is my checkbox field. Using g_form.getControl('resolving_change') to check if resolving_change field is visible on the form. But its not working.

Does anyone know a fix for this or an alternative I can use for g_form.getControl() in Service Portal?

-Gauri

1 ACCEPTED SOLUTION

Found a work around. I changed my logic to check the checkbox field is checked depending upon the value selected from some specific field. (To give you a bit of a background, scenario here is that - my checkbox field depends on the value selected from some other field).



In this particular case, it was not appropriate to use g_form.getControl().



As per Samiul's suggestion, for those who need to use g_form.getControl(), use g_form.hasField() instead. Works better in Service Portal.



-Gauri


View solution in original post

7 REPLIES 7

Jayanthi
Tera Contributor

Hi ,

Can you explain more on this. Am also struggling with getcontrol function .

Jayanthi
Tera Contributor

Hi ,

Can you explain more on this. Am also struggling with getcontrol function .

narendravarma
Tera Contributor

Hi,

 

There is a lot difference between g_form.getControl() and g_form.hasField().

g_form.hasField() will return true/false and nothing else possible, where g_form.getControl() returns HTML object So that you can read all the values to an array if it is select box. we can apply changes from script itself.