OnLoad g_form.removeOption not working

Maria20
Tera Guru

Hello SN Developers!

I have an onLoad event that is supposed to hide an option on a field if the user does not have a specific role (and conversely, add the option if they do).  I know the code is firing correctly because of the alerts I put in but the option is not working as expected. 

Here's my code:

Maria20_0-1666186196272.png

Any thoughts/suggestions?

1 ACCEPTED SOLUTION

@Maria20, yes thats actually the issue. The removeOption function does not work for reference fields. There you will have to use „reference qualifiers“ or ACL rules. 

Greetings, 

Sören

View solution in original post

7 REPLIES 7

Thank you both for your help.

 

Maria.

Hello,

 

As Soeren suggested,

 

Removing options will not work on a reference field. It's only valid if it were a choice field.

In this case you would need to create an advanced reference qualifier

Maria20
Tera Guru

Hello Soren,

 

Thanks for the reply.  So, "application" is my field name and "WFM Time Clocks" is one of the drop-down values.  It is a CI so I don't see a "value" field in the CI form.  I have tried with the sys_id and that doesn't work either.

 

I understand your reasoning for only using the .hideOption and I've tried that with no success.  The only reason I had both in my code was to try to get it to trigger properly (i.e. show me the correct alert) and it is definitely doing that.

 

The .hideOption is not working though.

 

Maria.