remove option is not working in the client script

chandan31
Tera Contributor

Hi All,

 

g_form.addOption('relation', 'Marriage_Spouses','Marriage- Spouse's siblings');
g_form.addOption('relation', 'Condolence_Spouses','Condolence- Spouse's parents');
 
This script is not working in the on change client script , Can you guide me how to write this one.
 
Thanks ,
Chandan
1 ACCEPTED SOLUTION

Rahul Talreja
Mega Sage
Mega Sage

Hi @chandan31 ,

You might be facing difficulties with usage of inverted commas.
Try:

g_form.addOption("relation", "Marriage_Spouses","Marriage- Spouse's siblings");
g_form.addOption("relation", "Condolence_Spouses","Condolence- Spouse's parents");
Please mark my response correct/helpful as applicable!
Thanks and Regards,
Rahul

View solution in original post

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@chandan31 

in question you are saying removeOption is not working

but the script you are sharing is for addOption()

Ensure you check docs and use valid syntax for both the functions

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

Hi ,

Sorry from my side  it is AddOption  not removeOption

Rahul Talreja
Mega Sage
Mega Sage

Hi @chandan31 ,

You might be facing difficulties with usage of inverted commas.
Try:

g_form.addOption("relation", "Marriage_Spouses","Marriage- Spouse's siblings");
g_form.addOption("relation", "Condolence_Spouses","Condolence- Spouse's parents");
Please mark my response correct/helpful as applicable!
Thanks and Regards,
Rahul

Aniket Chavan
Tera Sage
Tera Sage

Hello @chandan31,

It seems there might be an issue with the single quotes within the strings in your script. Try using double quotes inside the strings to avoid conflicts and also decide whether you want to use add/remove option and modify it accordingly.

Please try with the script below and let me know how it works for you.

g_form.addOption("relation", "Marriage_Spouses", "Marriage- Spouse's siblings");
g_form.addOption("relation", "Condolence_Spouses", "Condolence- Spouse's parents");

 

Let me know your views on this and Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks,
Aniket