web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

need to get data from html webresource

(0) ShareShare
ReportReport
Posted on by 76

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

I have the same question (0)
  • Verified answer
    N.A.R.A Profile Picture
    95 on at

    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/

  • Verified answer
    Preeti Sharma Profile Picture
    2,678 on at

    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.

  • Suggested answer
    Dynamics365 Rocker Profile Picture
    7,755 on at

    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
    Pawar Pravin Profile Picture
    5,237 on at

    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);

  • Verified answer
    Inogic Profile Picture
    764 on at

    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!

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans