Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Dynamics 365 9.0: formContext in Entity view

(0) ShareShare
ReportReport
Posted on by 678

Hi Experts,

I have a button that creates a copy of the current open record or selected record in Entity view. We added an additional parameter to the existing function for the primaryControl. The issue is the primaryControl is null when we are on the Entity view.

How can I access primaryControl or formContext from Entity view?

*This post is locked for comments

  • Pradeep Rai Profile Picture
    Pradeep Rai 5,482 Super User 2025 Season 1 on at
    RE: Dynamics 365 9.0: formContext in Entity view

    Hi,

    Looks good in Workbench side.

    What you are getting in script side? any debugging screenclip will be helpful

    Thanks,

    pradeep.

  • sunny1306 Profile Picture
    sunny1306 30 on at
    RE: Dynamics 365 9.0: formContext in Entity view

    Screenshot-_2800_32_2900_.png

  • Pradeep Rai Profile Picture
    Pradeep Rai 5,482 Super User 2025 Season 1 on at
    RE: Dynamics 365 9.0: formContext in Entity view

    Hi,

    Can you please share the screenshot of ribbon workbench for entity?

    Thanks,

    pradeep.

  • sunny1306 Profile Picture
    sunny1306 30 on at
    RE: Dynamics 365 9.0: formContext in Entity view

    I tried this but not woking

  • Suggested answer
    Pradeep Rai Profile Picture
    Pradeep Rai 5,482 Super User 2025 Season 1 on at
    RE: Dynamics 365 9.0: formContext in Entity view

    Hi Sunny,

    Please refer below below link:

    https://d365demystified.com/2020/06/21/pass-selected-rows-guids-to-ribbon-button-in-d365-ribbon-workbench/

    Thanks,
    Pradeep.

  • sunny1306 Profile Picture
    sunny1306 30 on at
    RE: Dynamics 365 9.0: formContext in Entity view

    Hi

    I am not getting the GUID of the selected record in HomeGridView with the same Js. Help me with this

  • Suggested answer
    LMP Profile Picture
    LMP 678 on at
    RE: Dynamics 365 9.0: formContext in Entity view

    Hi Ravi,

    I just realized. You are absolutely right that I will never get formContext from view because there is no form! Now I think I know the solution.

    Thank you~

  • Verified answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Dynamics 365 9.0: formContext in Entity view

    Hi,

    You will not get form context on the entity homepage grid (Entity view) as the form context builds when you open a form.

    The method FORMCONTEXT.data.entity.getId "Returns a string representing the GUID value for the record."

    https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/formcontext-data-entity/getid

    Hope this helps.

  • LMP Profile Picture
    LMP 678 on at
    RE: Dynamics 365 9.0: formContext in Entity view

    Hi Ravi,

    Thanks for the reply. I can retrieve the selected record on the Entity view, that is not the issue.

    I am upgrading the JavaScript code from Xrm.Page to formContext. On the one of the function, it has have the below code:

    "Xrm.Page.data.entity.getId()", and wants to change to "FORMCONTEXT.data.entity.getId".

    I added additional parameter to the function and is passing the primaryControl. On the record/form view, I can get the formContext from primaryControl but when on the Entity view, primaryControl is null (screenshot on previous post) that is why we are unable to access formContext.

    How can I access formContext from Entity view?

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Dynamics 365 9.0: formContext in Entity view

    Hi LMP,

    You need to use Crm Parameter = SelectedControlSelectedItemReferences, this will return you the selected records from the entity view. There are examples in the links I shared above.

    Hope this helps.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,407 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans