Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Unanswered

How to populate fields form a popup

Posted on by 5

Hi everyone, I have Dynamics 365 Online.

I have an entity called TrialEntity that has two field on the main form, let's call them A and B. 

An onchange event is triggered on A, and a webresource opens. The webresource allows users to choose a value from a drop down list and to press a Submit button. On that button click the chosen value must be inserted in the B filed on TrialEntity.

I can't figure out how to do this except from using code shown below

parent.Xrm.Page.getAttribute("B").setValue("*value retrived goes here*");

Unluckilly the previous line of code is not working since the GetAttribute gives me a null object as return. Can someone give me a piece of advice on how to update?

  • David L. Carr Profile Picture
    David L. Carr 75 on at
    RE: How to populate fields form a popup

    Hi Luca,

    My first question would be, could you re-design the process?  

    You mention that the users select a value from a drop down list.  If the values in that list are known to you in CRM when the TrialEntity form loads, then you could just create a simple option set field natively in CRM with those values.  (In other words, field B could be this option set.  And even if the option set values change based on other data, you may be able to use some JavaScript to modify the option set values available for the user to select.)

    Without knowing what your webresource does its tough to know if this is feasible...  Short term, field B could just be that option set, and the user may have to select it once in the webresource, and then again in field B.

    Hope this helps,

    Dave

  • Joana Pinto Profile Picture
    Joana Pinto 740 on at
    RE: How to populate fields form a popup

    Hi,

    That's not a problem, supposedly. You are not manipulating guids, just fields on the form. The form exists and that's your context. I've just try it on the create of the record and it worked fine. Check if the ClientGlobalContext.js.aspx script has the right path. Sometimes it's the root folder but other times it's the previous one, like this:

    <script src="../ClientGlobalContext.js.aspx" type="text/javascript"></script>

  • LucaStucchi Profile Picture
    LucaStucchi 5 on at
    RE: How to populate fields form a popup

    Wait I forgot a "little" particular. This happens when a new record is created and the popup is created BEFORE data savings, so the record does not exists.

  • LucaStucchi Profile Picture
    LucaStucchi 5 on at
    RE: How to populate fields form a popup

    Acutally I think i am missing that ClientGlobalContext.js.aspx script, let me try really quick and I'll reply again! Ty so far btw

  • Joana Pinto Profile Picture
    Joana Pinto 740 on at
    RE: How to populate fields form a popup

    Hi Luca,

    Are you sure that field "B" exists? Because I replicated that scenario on my trial environment and it went ok, I put a webresource on Account's form and update "fax" attribute from there, like this:

    
    
        
        
    
    
    
    
        
    
    
    

    And it updated ok.

    Regards,

    Joana

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans