Hi, my situation is that I have a field twice on the same form and I need to get one of them, I thought about getting the section and then the tab and the attribute, how can I do that?
Hello,
Attribute is the same but it has 2 controls. What's your scenario?
I tried this :
Xrm.Page.ui.tabs.get("tab").sections.get("Vehicle").getAttribute("colour")
I need to check if one of the "fields" is visiable
Attribute doesn't have visibility. Attribute is all about the data.
Control is about visible/hidden.
Try following:
Xrm.Page.ui.tabs.get("tab").sections.get("Vehicle").controls.get("colour")
or
Xrm.Page.ui.tabs.get("tab").sections.get("Vehicle").controls.get("colour1")
because indexing is used when there are multiple controls for the same field - docs.microsoft.com/.../controls-collection
it works great but now I have a new prob I need to set this control/attr as required and I fet errors:
if(Xrm.Page.ui.tabs.get("tab1").sections.get("section").controls.get("colour").getVisible()) - works
{
Xrm.Page.ui.tabs.get("tab1").sections.get("section").controls.get("colour").setRequiredLevel("required"); - doesn't work - error
Xrm.Page.ui.tabs.get("tab1").sections.get("section").controls.get("colour").getAttribute("colour").setRequiredLevel("required");- doesn't work - error
}
How do i do that?
Control doesn't have requirement level possibility. Attribute has. Try following:
Xrm.Page.getAttribute("colour").setRequiredLevel("required");
This works:
formContext.ui.tabs.get(3).sections.get(0).controls.get(0).getAttribute("msdyn_instructions").setRequiredLevel("required")
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Rishabh Kanaskar 235
MVP-Daniyal Khaleel 177
Tom_Gioielli 156 Super User 2025 Season 2