crm2011 handling the Save event and getting the current form information

Source: Internet
Author: User

Prevent records from being saved, Econtext: Current Context Object
function My_preventsavefunction (econtext) {
Econtext.geteventargs (). Preventdefault ();
}
Determine which operations start the store
function Getsavemodetextfunction (econtext) {
var savemodecode = Econtext.geteventargs (). Getsavemode ();
var savemodetext = "Unknown";
Switch (savemodecode) {
Case 1:
Savemodetext = "Save";
Break
Case 2:
Savemodetext = "Saveandclose";
Break
Case 5:
Savemodetext = "Deactivate";
Break
Case 6:
Savemodetext = "reactivate";
Break
Case 7:
Savemodetext = "Send";
Break
Case 15:
Savemodetext = "disqualify";
Break
Case 16:
Savemodetext = "Qualify";
Break
Case 47:
Savemodetext = "Assign";
Break
Case 58:
Savemodetext = "saveascompleted";
Break
Case 59:
Savemodetext = "Saveandnew";
Break
}
return savemodetext;
}
Gets the logical name of the current entity
var entityname = Xrm.Page.data.entity.getEntityName ();
Gets the current record of the ID
var recordId = Xrm.Page.data.entity.getId ();
Save current record
Xrm.Page.data.entity.save ();
Determine whether to change any data in the current record
var isDirty = Xrm.Page.data.entity.getIsDirty ();
Gets a string that represents the data that will be sent to the server when the record is saved
var dataxml = Xrm.Page.data.entity.getDataXml ();

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.