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 CRM (Archived)

Get value from HTML web application after submit the form

(0) ShareShare
ReportReport
Posted on by 50,091 Moderator

Hi Friends,

I have a third party application which is basically hosted in our CRM server IIS to get the address JSON and filled in the parent form, I want to open this html web application from my CRM form onchange event of a field. How can I open the website page  and get the JSON data on button click of HTML website and filled to CRM form.

I would appreciate if you help me on this .

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Andreas Cieslik Profile Picture
    9,267 on at

    Hi,

    have you heard of Alert.js.

    I really love this library and already used it in various projects:

    github.com/.../Documentation-v3.0

    You can use the onchange event to show the popup with iframe as explained in the link above.

    Use getIFrameWindow to access iframe fields and values.

    You could also access from your other web site the CrmContext like this:

    var crmWindow = new parent.Alert().getCrmWindow();

    crmWindow.Xrm.Page.getAttribute("name").setValue("something")

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at

    Thanks Andreas , I have tried this doesn't work  when I am accessing iframe content of external website I am getting security exception.

  • Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    HI Goutam,

    Are both sites using same security?

    Are you getting any errors?

  • gdas Profile Picture
    50,091 Moderator on at

    Hi Aric ,

    Yes my crm and the website both are http.

    Yes I am getting error says that I can not access iframe content due to security restrictions.

  • Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    I am not sure if this might be an issue, but in the IFRAME properties, on the General Tab in the Security Section, what is the value of Restrict cross-frame scripting, where supported?

    msdn.microsoft.com/.../gg328034.aspx

    Also, do both sites belong to the same zone in your Browser Internet Options (Local Intranet or Trusted Sites)?

    Not sure if any of these would help, but something to validate...

    Let me know...

  • Suggested answer
    Temmy Wahyu Raharjo Profile Picture
    2,916 on at

    Hi, 
    You can try to use sessionStorage to store value (must be string).

    https://developer.mozilla.org/en-US/docs/Web/API/Window/sessionStorage


    This one will clear after we closed the page. But if you still cannot used this one, you can try to use localStorage (more permanent and you must do clear after used).

    https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage

    So, on your custom html. You used set function. Then on crm, you get the value to do your action.

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at

    Thank you all for your suggestion !! Although those not fulfilled my requirement but it will help. 

    The security issue coming ,seems I can not access one web site (CRM) control from another website . I fixed this to make same URI , I have hosted the external website inside Microsoft Dynamics CRM folder in the IIS which makes same URI of my html website. Not sure is there any impact or not but my problem is fixed as per my requirement.

    Following are the code to open the Website - 

            var w = screen.width - 75;
            var h = screen.height - 200;
            var left = (screen.width / 2) - (w / 2);
            var top = (screen.height / 2) - (h / 2);
            var newWindow = window.open("14.48.56.5/.../test_iframe.html", "Address Search", 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
    


    And I am accessing the CRM control from the website below way -

       window.parent.opener.Xrm.Page.getAttribute("new_address1line1").setValue("street")

  • gdas Profile Picture
    50,091 Moderator on at

    Hello Guys ,

    I am again facing problem with focusing the new window when its open onchange of option set , its opening but the focus is not pointing to new window.

    Following I have written   and its not working.

    newWindow.focus();  

    Can anybody suggest please .

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at

    I have resolved this problem using settimeout , as I am opening the window on change of optionset  and as soon as I selected the optonset its first open the window and then its focusing the optionset.

    By using settimeout in the onchange function my problem has been resolved  and its focusing first the optionset and then open new window .

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 CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans