Click here to Skip to main content
13,344,508 members (54,008 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


7 bookmarked
Posted 4 Sep 2008

Submit Webpage from OnSave button in MS CRM Dynamics JavaScript

Rate this:
Please Sign up or sign in to vote.
This article willl help to submit a webpage using JavaScript in MS CRM Dynamics.


This article will help you to submit a webpage (asp, aspx, etc.) file from the CRM Dynamics OnSave button click event with JavaScript. This article will take the Account entity as an example and assumes that the webpage is already available to access from JavaScript.

Using the Code

The below steps need to be followed to customize the CRM Dynamics Account form.

  1. Select the form to customize and submit the webpage. This can be done by stepping through Settings->Customization->Account->Forms and Views-> Form.
  2. Add the IFrame to the form.
  3. Select the IFrame and click Change Properties.
  4. Enter the name and URL of the IFrame. URL is the path of the file where the webpage resides, e.g.: http://localhost:5555/sample.aspx.
  5. Check “Pass Object type****” if you would like to pass the form ObjectId as a parameter to the webpage. The form ObjectId is nothing but the AccountId of the Account entity which is selected from then Accounts screen.
  6. CRMSubmit/4.GIF CRMSubmit/3.GIF

  7. Now select Form Properties and select the Events tab (by default this tab will be shown).
  8. Select OnSave from the list and press the Edit button to write the JavaScript.
  9. On opening the new window select the “Event is enabled” checkbox. This will enable the CRM form to execute the JavaScript.
  10. Write the following JavaScript in the edit box to submit the form:
  11. var iframe = document.getElementById('IFRAME_AddressList');
    var iframeDoc = iframe.Document;
    var iframeForm = iframeDoc.getElementById('frmAddress'); = '_self';
    iframeForm.method = 'post';
    iframeForm.action ='http://localhost:5555/sample.aspx? Id='+crmForm.ObjectId;

    Here IFRAME_AddressList is the name of the iFrame. frmAddress is the form name in the ASPX page. Since the submission is to the same page the target is “_self”. crmForm.ObjectId is passed as a query string to get the AccountID in the ASPX page. (Since we are overriding the CRM Dynamics form submission, the query string needs to be passed explicitly.)

  12. Now close the JavaScript window by pressing the OK button and close the form properties window.
  13. Save and Close the form at the top left corner of the Form.
  14. Now publish the form with the menu Actions->Publish.

I hope this article will help you to submit a webpage from the CRM Dynamics form.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Shashidhar Rao Nellutla
Software Developer (Senior)
United Kingdom United Kingdom
Completed Masters in Computer Applications.

You may also be interested in...

Comments and Discussions

GeneralForm submit to server. Pin
Ajay Kale New18-Oct-10 21:42
memberAjay Kale New18-Oct-10 21:42 
Hi ,

I am submitting a html form in ASP.NET 1.1, to a websphere server. I am browsing excel file and submitting through object to Websphere server, by sybmitting form with action as Websphere hosted address.

Whenever I login to app, and try to upload the file with above functionality, for the first time, I get redirected to Login.aspx automatically. But when I re-login again and does the same thing as above, the file is uploaded successfully.

Can you please help me regarding this, as I have maintained releative values of timeout for session and form-authentication in web.config file.

- Ajay K

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.180111.1 | Last Updated 8 Mar 2013
Article Copyright 2008 by Shashidhar Rao Nellutla
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid