Quantcast
Channel: Neil Parkhurst's Activities
Viewing all articles
Browse latest Browse all 1616

JavaScript – CRM.Page.data.entity

$
0
0

In this post I want to quickly review some of the commonly used methods of XRM.Page.data.entity in terms of Dynamics 365 JavaScript.

I won’t document all of the capabilities here, just some of the methods I commonly use. If you need a full reference guide, please consult;

https://msdn.microsoft.com/en-us/library/gg334720.aspx#Xrm.Page.data.entity Properties and Methods

getEntityName

Useful if you need the entity name for the current record.

Var entityName = Xrm.Page.data.entity.getEntityName();

getId

Useful if you want to know the GUID for the current record

Xrm.Page.data.entity.getID();

getIsDirty

Useful if you want to know if any unsaved changes exist.

var isDirty = Xrm.Page.data.entity.getIsDirty();

This will return true is false is the page is dirty or not.

getPrimaryNameAttribute

Useful if you want to return then primary name of the current entity. (So on contact it would show fullname, on account name etc etc.)

var name = Xrm.Page.data.entity.getPrimaryAttributeValue();

save

Saves the current record!

Xrm.Page.data.entity.save(); // ** Just saves current record
Xrm.Page.data.entity.save("saveandclose") // ** Does a save and close
Xrm.Page.data.entity.save("saveandnew") // ** Save and new

These are all simple code snippets that are often used in JavaScript in Dynamics 365 forms. J


Filed under: JavaScript Tagged: Dynamics 365, JavaScript

Viewing all articles
Browse latest Browse all 1616

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>