How to get Values from Custom with Label Variable ? How to set limit of values and restrict submit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2022 05:56 AM
There is a variable Custom with Lable for selecting multiple change requests. It should have at least 3 values before the submit form.
I have added script :
var Changes = g_form.getvalue("field_name").toString().split(',');
var changes_length = Changes.length;
if(changes_length>=3){
return true;
}
return false;
But this is always return false . How to achieve this can anyone please help ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2022 06:19 AM
Hi @S Deva
Is your variable type is List collector?
Can you show how your variable and its values look?
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2022 06:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2022 06:35 AM
This is the variable belongs to Propose new standard change Record Producer
We can select multiple changes in this field. and here the requirement is at least it should have 3 values if not restrict the form to submit. Can you please guide me how can we achieve ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2022 06:47 AM
Hello @S Deva ,
That field is rendering through macro .it not a variable which is created on the form .its a macro as you can see in your custom with label field there is a macro attached so the values are coming from there .
In this case you might have to handle the scenario in macro code .Because you cant access the values selected in macro in a client script
Hope this helps
Mark my answer correct if this helps you
Thanks