Need help in overriding dependent functionality
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-10-2017 01:57 AM
Hello All, I am facing some issue with dependent values.Please suggest how to override.
Below is my scenario: I have one domain "A" .In that let's say 5 companies are there.In the incident form,as per the company basis,the category field is populating the choices.Also,category and subcategory is dependent and it is set in the dictionary. Now I have some specific choices(let's say 10) belongs to "one company only" should be visible in subcategory field.For other companies those 10 choices should not be visible.
Now the problem is,if I put dependent to these 10 choices,to my categories(choices)then it will reflect to all the companies in the domain. Please suggest how to achieve this.Is this possible when dependent of subcategory chosen as category?
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2017 01:37 AM
Hi Nitish,
Below is the sample code that I have pasted,This is a On-change CS on category.If I disable dependent checkbox in dictionary,its working fine.If I enable the checkbox,then this script is not working.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
g_form.clearOptions('subcategory');
return;
}
if (newValue == 'software' && g_form.getValue('company')=='378c68d80f8142006a755c3be1050e02'){
alert("Category is software and company is X");
g_form.addOption('subcategory' , 'antivirus','Anti-Virus',0);
g_form.addOption('subcategory' , 'backup','Backup',10);
}
//Type appropriate comment here, and begin script below
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2017 02:04 AM
Hey Bharath,
Instead of using clearOption in the isLoading part, did you try using removeOption in the else part?
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue == '') {
return;
}
if (newValue == 'software' && g_form.getValue('company')=='378c68d80f8142006a755c3be1050e02'){
alert("Category is software and company is X");
g_form.addOption('subcategory' , 'antivirus','Anti-Virus',0);
g_form.addOption('subcategory' , 'backup','Backup',10);
}
else{
alert("Category is software and company is Y");
g_form.removeOption('subcategory' , 'antivirus','Anti-Virus',0);
g_form.removeOption('subcategory' , 'backup','Backup',10);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2017 08:15 PM
Hi Nitish,
Yes,I have used.But No luck.