Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Answered

help with javascript for a newby

Posted on by 448

Hi all,

I'm starting to write some piece in javascript for our D365s. I want to retrive data of column in parent form and set a column in form child.

As it can see in 2nd picture, in console.log the data is retrieved and are correct, but it's not charged on variable "AmbitoName" (picture 3rd).

Where I'm mistaken?

thanks for any help or suggestion.

pastedimage1672334170710v1.png

pastedimage1672334422353v2.png

pastedimage1672334530227v3.png

  • DiePic Profile Picture
    DiePic 448 on at
    RE: help with javascript for a newby

    Hi Bipin Kumar 

    thanks a lot for your precious help.

    Now it work.

  • Verified answer
    Bipin D365 Profile Picture
    Bipin D365 28,964 Super User 2024 Season 1 on at
    RE: help with javascript for a newby

    Hi,

    Please check below article on the usage of async await

    www.google.com/url

  • DiePic Profile Picture
    DiePic 448 on at
    RE: help with javascript for a newby

    Hi @Guido Preite and thanks for your reply.

    The "print results" are only for my control, but I need of this variable to set another field in child page ... how must I do to have immediatley this variable?

    Can you give me more details about "you can use the async/await pattern"?

  • Suggested answer
    Guido Preite Profile Picture
    Guido Preite 54,081 Super User 2024 Season 1 on at
    RE: help with javascript for a newby

    because the Xrm.WebApi is asynchronous, meaning that your openAlertDialog is executed before the success is completed.

    If you move the "print results" code inside the success function it will show the correct value. (or you can use the async/await pattern but in your case is probably easier to put the code inside the success function)

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,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans