Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

need to get data from html webresource

Posted on by 70

Hello friends,

On button click on crm contact page i will open html page replicate to contact (same fields but all text fields). after entering data on html page and click on submit i need to retrieve all fields data and place it in crm contact fields.. how can i do this using java script.. a little bit help please.

thanks

*This post is locked for comments

  • Verified answer
    Inogic Profile Picture
    Inogic 24,094 on at
    RE: need to get data from html webresource

    Hi Hemanth,

    In order to work with HTML Web resource you must need to add reference to ClientGlobalContext.js.aspx in your HTML Code as shown below:

     

    <script src="../ClientGlobalContext.js.aspx"></script>

     

    Also add reference to JavaScript Web Resource which you will call on click of Submit button.

     

    After clicking submit button, function will retrieve data of all text fields in HTML using JavaScript or Query as shown below:

     

    Using JavaScript:

    var text=document.getElementById("txtvalue").value

     

    Using Query:

    var text=$("# txtvalue ").val()

    Once you have the data of text fields in HTML, you can easily map field value to the fields in CRM as shown below:

    window.opener.Xrm.Page.getAttribute("fieldvalue").setValue(text);

    Thanks!

  • Verified answer
    Pawar Pravin  Profile Picture
    Pawar Pravin 5,227 on at
    RE: need to get data from html webresource

    Hi Hemanth Reddy,

    As you have mentioned here that you are using text fields inside HTML to replicate data from contact. Are you trying it for all data types I mean lookup, optionset, boolean, etc.

    If are just placing single line text or multiline text then you need to use

    window.opener.Xrm.Page.getAttribute('fieldlogicalname').setValue(ValueHere);

  • Suggested answer
    Dynamics365 Rocker Profile Picture
    Dynamics365 Rocker 7,755 on at
    RE: need to get data from html webresource

    You have to retrieve certain field of contact.

    You can use fetch xml or can use below script:

    var formContext=ExecutionContext.getFormContext;

    window.opener.formContext.getAttribute('fieldname').getValue();

  • Verified answer
    Preeti Sharma Profile Picture
    Preeti Sharma 2,678 on at
    RE: need to get data from html webresource

    Hi,

    After entering data on the custom HTML form on click of Submit you need to get just fields of current form.

    Once you get attributes you can update fields on Contact form.

    To get attributes you can write below script:

    window.opener.Xrm.Page.getAttribute('fieldname').getValue();

    Hope this helps:)

    Thanks

    Preeti Sharma.

  • Verified answer
    N.A.R.A Profile Picture
    N.A.R.A 95 on at
    RE: need to get data from html webresource

    Hi you can Xrm.Internal.openDialog to call HTML form

    and using CallbackFucntion to get the data return from HTML

    u must add ClientGlobalContext.js.aspx to the HTML so you can return the value form HTML

    You can see this tutorial

    https://nishantrana.me/2015/06/17/using-xrm-internal-opendialog-as-an-alternate-to-showmodaldialog-in-crm/

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,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans