Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Dynamic choices in multiple choice variable type

Brijmohan
Tera Contributor

Hi, is there any way to set dynamic choice in multiple choice variable type. I have tried below client script that is working for select box type but not for multiple choice type. 

function onLoad() {

    var userEmail = g_user.email;

    var splitEmail = userEmail.split('@');
    var userName = splitEmail[0];
    var domain = splitEmail[1];

    var newEmail = userName + '1@' + domain;

	var label1 = "No thanks. I will keep " + userEmail;
	
    g_form.removeOption('v_email_address', 'keep');
    g_form.addOption('v_email_address', 'keep', label1);

    g_form.removeOption('v_email_address', 'new');
    g_form.addOption('v_email_address', 'new', newEmail);

}

 

Thanks in advanced!

Brijmohan

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

@Brijmohan 

not possible with multi select variable type.

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron

@Brijmohan 

not possible with multi select variable type.

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

Tanushree Maiti
Kilo Patron

Hi @Brijmohan 

 

addOption, removeOption does not work on Multiple choice type variable. It works fine with Select Box type variable .

 

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: