Click here to Skip to main content
Licence CPOL
First Posted 4 Sep 2008
Views 11,341
Bookmarked 2 times

Submit Webpage from OnSave button in MS CRM Dynamics Javascript

By | 4 Sep 2008 | Article
This article willl help to submit a webpage using javascript in MS CRM Dynamics

Introduction

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

Using the Code

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 the Change Properties
  4. Enter the name and URL of the IFrame. URL is the path of the file where the webpage resides ex: 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. Form ObjectId is nothing but the AccountId of the Account entity which is selected from Accounts screen.
    4.GIF3.GIF
  6. Now select Form Properties and select the events tab (by default this tab will be shown).
  7. Select the OnSave from the list and press the edit button to write the JavaScript.
  8. On opening the new window select the “Event is enabled” checkbox. This will enable the CRM form to execute the javascript.
  9. Write the following JavaScript in the edit box to submit the form
var iframe = document.getElementById('IFRAME_AddressList');

var iframeDoc = iframe.Document;

var iframeForm = iframeDoc.getElementById('frmAddress');

iframeForm.target = '_self';

iframeForm.method = 'post';

iframeForm.action ='http://localhost:5555/sample.aspx? Id='+crmForm.ObjectId;

iframeForm.submit();

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 query string to get the AccountID in the aspx page
(Since we are overriding the CRM Dynamics form submission the query string need to be
passed explicitly).

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

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

License

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

Member

Completed Masters in Computer Applications.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralForm submit to server. PinmemberAjay Kale New20:42 18 Oct '10  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    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 | Mobile
Web04 | 2.5.120517.1 | Last Updated 4 Sep 2008
Article Copyright 2008 by Shashidhar Rao Nellutla
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid