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 :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested Answer

how to collect value from javascript when fields present on form from other entity

(0) ShareShare
ReportReport
Posted on by 836

Hi when we use quickview form we generally follow this


var quickViewControl = formContext.ui.quickForms.get("quickviewname");
var myValue = quickViewControl.getControl("internalname").getAttribute().getValue();

This works totally fine. But now work order form of customer is embedded in booking. and this work order customer form is main form, and i am not able to extract it's value on booking form. Can someone help how do i extract value by javascript.

Thank you

I have the same question (0)
  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    But now work order form of customer is embedded in booking. and this work order customer form is main form

    What do you mean by this?

    Can you please send screenshot of Booking form?

    I have checked booking form on my instance and I don't see any work order form embedded into it. How did you embedd work order form to booking form?

    Please mark my answer verified if i were helpful

  • Ravi Fulani Profile Picture
    836 on at

    There is work order customer and work order service forms are there, which recently have been introduced in Work order entity by microsoft teams.  Now these two forms are embedded in booking and work order form of Bookable resource booking entity. They took a lookup field of work order and added custom control in it which shows full form of work order form in booking entity's main form.

    pastedimage1599634567975v1.png

    pastedimage1599634724333v2.png

    pastedimage1599634950166v1.png

    if this would have been a quick view form I know how to extract the value.  I can edit these fileds in booking form as they are editable. All i need a way to abstrat their value via Javascript

  • Community Member Profile Picture
    on at

    Hi Ravi,

    you mean that it took lookup field of work order, so you can use web Api to retrieve lookup entity by id to get value of the field you need.

    Refer this:

    https://community.dynamics.com/crm/b/passiondynamics/posts/get-lookup-value-from-other-entity-and-set-it-on-the-form-using-web-api-in-microsoft-dynamics-crm

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

  • Ravi Fulani Profile Picture
    836 on at

    I am using lookup present on bookable resource entityt form, just want to know if there is a direct way to get them like we can do for quick view, that would be easy and simple.

  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    When I checked the configuration it used Quick View Form only.

    <QuickForms><QuickFormIds><QuickFormId entityname="msdyn_workorder">613513a1-322d-4ecc-81bd-bd65640d834c</QuickFormId></QuickFormIds></QuickForms>

    Have you tried using same quick view JS code to retrieve the value?

    Yes it used PCF Form Component control to embed Work Order form and not using quick view form directly as we do it normally on form ->Insert->Quick View Form

    Please mark my answer verified if i were helpful

  • Alejandro Cesetti Profile Picture
    205 on at

    Hello Ravi!!

    Have you found a solution for this?

  • Suggested answer
    antc Profile Picture
    2,909 on at

    Anyone trying to this here is the JS required:

    You can use the console to work out the names or index to use.

    var info = formContext.ui.tabs.get(3).sections.get(0).controls.get(0).getAttribute("msdyn_instructions").getValue();
    The above example is using the tab 3, section 0, Control 0 to get the Work Order attribute value and below can help during debugging in console:
    pastedimage1637566362881v1.png
  • Suggested answer
    Alejandro Cesetti Profile Picture
    205 on at

    After working with MS support they provided the code that should work for PCF Form Component:

    //this value defines if the control was already loaded. I added a 1 because I have the field twice in the form

    var wasContentLoaded = formContext.getControl("regardingobjectid1").isLoaded();

    if (wasContentLoaded && formContext.getControl("regardingobjectid1").data.getIsDirty())

    {

    // if any field of the form component got updated

    var object = new Array();

    object[0] = new Object();

    object[0].id = formContext.data.entity.getId();

    object[0].name = formContext.data.entity.getPrimaryAttributeValue();

    object[0].entityType = formContext.data.entity.getEntityName();

    formContext.getControl("regardingobjectid1").data.entity.attributes.get("cus_phonecall").setValue(object);

    }

    In this example I am updating the cus_phonecall field from the related entity.

    This is working fine in my environments.

    I hope this helps!!

    Best,

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 > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 80

#3
Martin Dráb Profile Picture

Martin Dráb 64 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans