Multiple dependent Values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2019 04:33 AM
Hi Friends,
I have below incident form which are all dependent values. Up to "Place" field , I have defined Choice as per dependent value , but now same "Types of services" are present in different places with different "Service Identifier" , I meen both the values are dependent on Place value.
I have create one onChange client script as below, which is not working.
Can any one help me out.
Thanks
Nayak
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var place = g_form.getValue('u_location');
var stype = g_form.getValue('u_type_of_service');
if(place == "SARPAVARAM" && stype == "Global VPN") {
g_form.setValue('u_service_identifier',"091KAKI623006982554");
g_form.setValue('u_service_identifier',"091KAKI623012998901");
} else if(place == "Madhurawada" && stype == "Internet Access Service") {
g_form.setValue('u_service_identifier',"091HYDE030005406685");
} else if(place == "Madhurawada" && stype == "Global VPN") {
g_form.setValue('u_service_identifier',"091VISH623006982519");
g_form.setValue('u_service_identifier',"091VISH623006982484");
} else {
g_form.setValue('u_service_identifier',"1"); }
}
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2019 06:11 AM
Instead of using setValue, try using g_form.addOption(); to add two available choices for the Service identifier field.
This way, you will be able to see two choices in the dropdown to select any one.
Mark my answer as correct or helpful if it helped.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2019 03:33 AM
Hi Narendra,
Thanks for replay,
I have modified the script as below but not getting actual result.(still getting 3 values, i should get 2 values). Please find below table
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var place = g_form.getValue('u_location');
var stype = g_form.getValue('u_type_of_service');
if(place == "SARPAVARAM" && stype == "Global VPN") {
g_form.addOption('u_service_identifier','091KAKI623006982554','091KAKI623006982554',1);
g_form.addOption('u_service_identifier','091KAKI623012998901' , '091KAKI623012998901', 2);
} else if(place == "Madhurawada" && stype == "Internet Access Service") {
g_form.addOption('u_service_identifier','091HYDE030005406685', '091HYDE030005406685', 1);
} else if(place == "Madhurawada" && stype == "Global VPN") {
g_form.addOption('u_service_identifier','091VISH623006982519','091VISH623006982519', 1);
g_form.addOption('u_service_identifier','091VISH623006982484','091VISH623006982484' ,2 );
} else {
g_form.addOption('u_service_identifier',""); }
}
Thanks,
Nayak

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2019 06:52 AM
Try this,
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var place = g_form.getValue('u_location');
var stype = g_form.getValue('u_type_of_service');
if(place == "SARPAVARAM" && stype == "Global VPN") {
g_form.addOption('u_service_identifier','091KAKI623006982554','091KAKI623006982554',1);
g_form.addOption('u_service_identifier','091KAKI623012998901' , '091KAKI623012998901', 2);
} else if(place == "Madhurawada" && stype == "Internet Access Service") {
g_form.addOption('u_service_identifier','091HYDE030005406685', '091HYDE030005406685', 1);
} else if(place == "Madhurawada" && stype == "Global VPN") {
g_form.removeOption('u_service_identifier','091HYDE030005406685','091HYDE030005406685' );
g_form.addOption('u_service_identifier','091VISH623006982519','091VISH623006982519', 1);
g_form.addOption('u_service_identifier','091VISH623006982484','091VISH623006982484' ,2 );
} else {
g_form.addOption('u_service_identifier',""); }
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2019 07:17 AM
Hi Narendra,
Have you ever used Data Lookup Tables?
I believe it will allow you to set a field based on multiple other values, and it's designed to be used codelessly.