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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

xrm.navigation.openform set lookup field automatically from the previous form

(0) ShareShare
ReportReport
Posted on by 45
I have the same question (0)
  • Pradeep Rai Profile Picture
    5,489 Moderator on at

    Hi,

    If i understand it correctly then on "Parcours" entity form, you have added Ribbon Button to open the "Question" entity records.
    Now, on "Question" entity you have a lookup field of "Parcours" entity. and you want the "Parcours" entity Id.

    To achieve this please follow below steps:

    1. On Ribbon button add one Parameters as shown in below screenshot:
    d365demystified.com/.../

    2. In your JS file you can use below code get the "Parcours" record Id:
    formContext.data.entity.getId();

    FormContext you will get from first step.

    Now, you have the "Parcours" entity id with you and you can add this in your above code.

    Thanks,
    Pradeep.

    Please mark this as VERIFIED. if it helps.

  • Pradeep Rai Profile Picture
    5,489 Moderator on at

    Add on to above

    One question i have, As per the above screenshots 1 Parcours can have multiple Questions.

    Which mean we have 1:N relationship between them.

    So, why you are creating new ribbon to open the Question records. You can use Related Tab or You can add subgrid of Questions entity on "Parcours".

    With OOB way you can use Quick Create and Main form to fill the details. here, you can use the Relation Mapping concept to prepopulate the field values.

    Thanks,

    Pradeep.

  • Community Member Profile Picture
    on at

    Hi Omar Bouattour,

    As Pradeep Rai said, you can get FormContext first and then use getEntityReference() to get lookup value of Parcours.(API: https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/formcontext-data-entity/getentityreference).

    Here is a thread which is same as the things you are doing(If I don't misunderstand), you can refer to it:

    community.dynamics.com/.../how-to-pass-javascript-entity-1-record-data-via-extraq-parameters-to-entity-2-via-javascript-by-means-of-add-new-record-subgrid 

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 108 Super User 2025 Season 2

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans