web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

How to get specific attribute from a specific tab and section

(0) ShareShare
ReportReport
Posted on by 645

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?

I have the same question (0)
  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: How to get specific attribute from a specific tab and section

    Hello,

    Attribute is the same but it has 2 controls. What's your scenario?

  • sahara Profile Picture
    645 on at
    RE: How to get specific attribute from a specific tab and section

    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

  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: How to get specific attribute from a specific tab and section

    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

  • sahara Profile Picture
    645 on at
    RE: How to get specific attribute from a specific tab and section

    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?

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: How to get specific attribute from a specific tab and section

    Control doesn't have requirement level possibility. Attribute has. Try following:

    Xrm.Page.getAttribute("colour").setRequiredLevel("required");

  • antc Profile Picture
    2,909 on at
    RE: How to get specific attribute from a specific tab and section

    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.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 235

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 177

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 156 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans