Choice list options should be visible as per other three choice field selection in record producer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2023 10:40 PM - edited 02-22-2023 10:42 PM
Hi All ,
I have requirement in a record producer there 4 choice variables based on the 3 choice variables selection the choice list should populate in the 4th choice list.
Example there are Field 1 : 'Name' which has choices ( Anita , Nithya , Sunita, Swetha )
Field 2 : 'Address' which has choices ( Pune , Bangalore , Chennai , Mumbai )
Field 3 : 'State ' which has choices ( Closed , Open , Onhold , Incomplete)
Field 4 : 'Software' which has choices ( Azure , Microsoft , Google, Jira )
Name | Address | State | Software |
Anita | Pune | Closed | Azure |
Nithya | Bangalore | Open | Mircosoft |
Sunita | Chennai | Onhold | |
Swetha | Mumbai | Incomplete | Jira |
So when in name field ' Sunita' , in address field its 'Bangalore , state field is 'Onhold' then in 'Software' field choices Microsoft and Google should show as choice and other choices Azure and Jira should be hidden.
Similarly as per the other choices same Software field choices should change.
i have tried onChange client script of Name field :
Var aa = g_form.getValue(' Name');
Var bb= g_form.getValue(' Address');
Var cc= g_form.getValue(' State ');
Var dd= g_form.getValue(' Software');
if (aa=='Sunita' && bb=='Bangalore' && cc=='Onhold')
{
g_form.removeOption('software' , 'azure' , 'Azure');
g_form.removeOption('software' , 'jira ' , 'Jira ');
g_form.addOption('software', 'microsoft ', 'Microsoft');
g_form.addOption('software', 'google', 'Google ');
}
@Ankur Bawiskar @Saurav11 @Ratnakar7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 02:34 AM
Hi prince_aroara,
my script after modification is this below
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
g_form.clearOptions('u_application');
return;
}
var bu = g_form.getValue('business_unit_one');
var seg = g_form.getValue('segment');
var reg = g_form.getValue('u_region');
g_form.clearOptions('u_application');
}
if (newValue=='incentives' && seg =='Enterprise' && reg=='APAC'){
g_form.addOption('u_application', 'CRM/PSA','CRM/PSA');
g_form.addOption('u_application', 'Sales Navigator', 'Sales Navigator');
}
else if( newValue == 'Commerce' && seg == 'Enterprise' && reg == 'US & Canada'){
g_form.addOption('u_application', 'Drift', 'Drift');
g_form.addOption('software', 'Seismic', 'Seismic');
}
in the application field drop down its not showing the application as per business unit and segment and region selected
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 02:42 AM
@ServiceNow10sun ,
Please remove the unwanted bracket from the code and add a bracket at the end of script
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
g_form.clearOptions('u_application');
return;
}
var bu = g_form.getValue('business_unit_one');
var seg = g_form.getValue('segment');
var reg = g_form.getValue('u_region');
g_form.clearOptions('u_application');
if (newValue=='incentives' && seg =='Enterprise' && reg=='APAC'){
g_form.addOption('u_application', 'CRM/PSA','CRM/PSA');
g_form.addOption('u_application', 'Sales Navigator', 'Sales Navigator');
}
else if( newValue == 'Commerce' && seg == 'Enterprise' && reg == 'US & Canada'){
g_form.addOption('u_application', 'Drift', 'Drift');
g_form.addOption('software', 'Seismic', 'Seismic');
}
}
Also please check whether you have used the correct backend values of fields.
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 02:55 AM
Hi,
I have used this script still its not working , and i have noticed one thing it takes only one condition in if statement (
newValue=='incentives'
its not taking the
&& seg =='Enterprise' && reg=='APAC'
&& conditions ,and also in the on change client script there is a variable name field i have to select it to business_unit_one only then the first if condition if newvalue = incentives works.
i tired selecting variable name as NONE and tried as well still its note working
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 03:06 AM
Please update your script as follow for just in if condition:
if (isLoading ) { //remove || newValue == ''
g_form.clearOptions('u_application');
return;
}
For rest of the scenarios please check whether you are picking the right backend name of the variables mentioned below:
var seg = g_form.getValue('segment');// check the backend name of this field
var reg = g_form.getValue('u_region');
add alert in the script to check the values of both:
alert( g_form.getValue('segment') + g_form.getValue('u_region')); // add this in your script to trace the values of variables.
If my answer solved your issue, please mark my answer as ✅Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 05:47 AM
Hi,
I have checked the backend value of each field using alert and i can see the output for each field in alert how ever the alert function is not getting triggered inside the if condition as below.
it means the if condition with three condition check is not working, However when i am giving only one condition if (NewValue='incidentives') its working.
Please suggest if there is any other issue in the conditions which i have declared below or any other way of checking three conditions .
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
//g_form.clearOptions('u_application');
return;
}
var bu = g_form.getValue('business_unit_one');
var seg = g_form.getValue('segment');
var reg = g_form.getValue('region');
//var app = g_form.getValue('application');
//g_form.clearOptions("u_application");
if (newValue == 'incentives' && seg == 'enterprise'&& reg == 'APAC')
{
alert('enterprise'+'seg');
g_form.removeOption("application",'Gong');
}
else if (newValue == "commerce" && seg == 'enterprise' && reg == 'USCanada') {
alert('reg');
g_form.addOption("application",'Marketo','Marketo');
}
}