07-24-2023, 06:24 AM
I have a option set column called "Business Unit" in Micrsoft Dynamics CRM and the options are
"Edge"
"Core"
"Cloud"
Then I have another option set column called "Business category" and the options are
"Hardware"
"Software"
"Services"
If I select any option on "Business Unit" then the dropdown from "Business Category" should pop up based on the option, I selected in "Business Unit"
For eg:-
1. If I select "Edge", then only "Hardware" should pop up
2. If I select "Core" then "Hardware" and "Software" should pop up
3. If I select "Cloud" then "Hardware" and "Software" and "Services" should pop up
We are trying with JScript in CRM, but it is showing some error. Can anyone help me out how to write a script to achieve this process. I have to do this on priority.
If I select any option on "Business Unit" then the dropdown from "Business Category" should pop up based on the option, I selected in "Business Unit"
For eg:-
1. If I select "Edge", then only "Hardware" should pop up
2. If I select "Core" then "Hardware" and "Software" should pop up
3. If I select "Cloud" then "Hardware" and "Software" and "Services" should pop up
I tried writing using array but its showing error.
My code: -
var B_line_arr = window.B_line_arr || {};
(function() {
this.formOnLoad = function (executionContext){
var formContext = executionContext.getFormContext();
var businessarea = formContext.getAttribute("new_buniessarea21").getText();
var businessline = formContext.getAttribute("new_buniessline21")
if(businessarea=="Edge")
{
var arr = [{value: 100000000, text: 'Hardware'},
{value: 100000001, text: 'Software'},
{value: 100000002, text: 'Services'}];
for(var i=0;i<=arr.length;i++)
{
businessline.clearOptions();
businessline.addOption({value: arr[0].value, text: arr[0].text});
}
}
}
}).call(B_line_arr)
```
"Edge"
"Core"
"Cloud"
Then I have another option set column called "Business category" and the options are
"Hardware"
"Software"
"Services"
If I select any option on "Business Unit" then the dropdown from "Business Category" should pop up based on the option, I selected in "Business Unit"
For eg:-
1. If I select "Edge", then only "Hardware" should pop up
2. If I select "Core" then "Hardware" and "Software" should pop up
3. If I select "Cloud" then "Hardware" and "Software" and "Services" should pop up
We are trying with JScript in CRM, but it is showing some error. Can anyone help me out how to write a script to achieve this process. I have to do this on priority.
If I select any option on "Business Unit" then the dropdown from "Business Category" should pop up based on the option, I selected in "Business Unit"
For eg:-
1. If I select "Edge", then only "Hardware" should pop up
2. If I select "Core" then "Hardware" and "Software" should pop up
3. If I select "Cloud" then "Hardware" and "Software" and "Services" should pop up
I tried writing using array but its showing error.
My code: -
var B_line_arr = window.B_line_arr || {};
(function() {
this.formOnLoad = function (executionContext){
var formContext = executionContext.getFormContext();
var businessarea = formContext.getAttribute("new_buniessarea21").getText();
var businessline = formContext.getAttribute("new_buniessline21")
if(businessarea=="Edge")
{
var arr = [{value: 100000000, text: 'Hardware'},
{value: 100000001, text: 'Software'},
{value: 100000002, text: 'Services'}];
for(var i=0;i<=arr.length;i++)
{
businessline.clearOptions();
businessline.addOption({value: arr[0].value, text: arr[0].text});
}
}
}
}).call(B_line_arr)
```