Hello guys,
I have a column (Choice-Column type ) rh_locations with Location A/B/C
Then I have a lookup to a table Phonebook.
My Plan is, based on the selected Location the default view of the subgrid should change to other views I already made (filtered by Location)
I tried the following code in a JSON and made an EventHandler OnLoad of the Form and OnChange on the Choice Column.
The Code doesn't throw an error but it won't work.
var OnBoarding = window.OnBoarding || {};
(
function() {
this.setDefaultView = function(executionContext){
var officeLocation = Xrm.Page.getAttribute("rh_standort").getValue();
var lookupField = Xrm.Page.getControl("rh_geschaftsnummer");
// Check the selected office location and set the appropriate view
if (officeLocation === "Naila") {
lookupField.setDefaultView("bf3591dd-7eb6-ed11-83fe-0022489ca5c5");
} else {
lookupField.setDefaultView("488fdd3f-7fb6-ed11-83fe-0022489ca5c5");
}
}
}
).call(OnBoarding)Can you help me?

Report
All responses (
Answers (