Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum
Answered

Alternate Field In Lookup after Save

Posted on by 40

I have a lookup field on a form which normally displays the primary key associated with the other entity.  Looking for a way to display an alternate field from the other entity that holds after Save without affecting Save & Close expected functionality.

Example

-Entity called Outcome has a lookup field to an entity called Individual Service - lookup field is called dhsive_individualservice

pastedimage1621349790356v1.png

Then in the Individual Service entity, primary key in this example is IS-1001 and there is a Service Start Date field - dhsive_servicestartdate

pastedimage1621349954014v2.png

Looking for a good way for the form associated with the Outcome entity to display an alternate field in the lookup.....something like below or similar....where dhsive_servicestartdate would display instead of the primary key field

pastedimage1621350199952v3.png

I can achieve this for an onLoad event on the Outcome entity/form by doing something similar to below:

-Do an HTTPRequest/JSON to get the associated field values in the Individual Service entity

var v = _formContext.getAttribute("dhsive_individualservice").getValue(); //lookup field on Outcome associated with Individual Service

v[0].name = results.value[0]["dhsive_servicestartdate"]; //Get the desired alternate field from the associated lookup entity

 _formContext.getAttribute("dhsive_individualservice").setValue(v); //Set the lookup field on Outcome to show the alternate field

This type of approach seems to work well for onLoad, but of course after saving, the lookup field defaults back to the value from the primary key in the associated entity.

If trying something like forcing a page refresh after Save, it works but then Save and Close doesn't work as expected as the refresh happens before closing.

Is there some type of approach which would allow to see the alternate field in the lookup after Save and also allow Save & Close to still work as expected?

  • Suggested answer
    jlmccormack Profile Picture
    jlmccormack 40 on at
    RE: Alternate Field In Lookup after Save

    Yes, I would agree that using the Quick View form is the best approach.  Appreciate the information!

  • Verified answer
    Wahaj Rashid Profile Picture
    Wahaj Rashid 11,319 on at
    RE: Alternate Field In Lookup after Save

    Hi,

    Thank you for your query.

    The better approach would be to use a Quick View form.

    You can create a quick view form for the related entity (Individual Service), add fields you need to display.

    Then after the lookup field, add the quick view form component on the form to show other fields from the relate entity.

    Create or edit quick view forms in Dynamics 365 Customer Engagement (on-premises) | Microsoft Docs

    Example:

    Dynamics 365: Quick View Forms - The Marks Group | Small Business Consulting | CRM Consultancy

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

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

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,552 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,552 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans