Get the value from a
CRM field
var varMyValue = Xrm.Page.getAttribute(“
fieldName”).getValue() ;
Set the value of a
CRM field
Xrm.Page.getAttribute(“
fieldName”).setValue(‘My New Value’);
Hide/Show a
tab/section
Xrm.Page.ui.tabs.get(5).setVisible(false);
Xrm.Page.ui.tabs.get(5).setVisible(true);
Hide/Show field
Xrm.Page.ui.controls.get(fieldName).setVisible(false);
Xrm.Page.ui.controls.get(fieldName).setVisible(true);
Call the onchange
event of a field
Xrm.Page.getAttribute(“ fieldName”).fireOnChange();
Get the selected
value of picklist
Xrm.Page.getAttribute(“
fieldName”).getSelectedOption().text;
Set the requirement
level
Xrm.Page.getAttribute(“
fieldName”).setRequiredLevel(“none”);
Xrm.Page.getAttribute(“
fieldName”).setRequiredLevel(“required”);
Xrm.Page.getAttribute(“
fieldName”).setRequiredLevel(“recommended”);
Update a readonly
field
Xrm.Page.getAttribute("fieldName").setSubmitMode("always");
Set the focus to a
field
Xrm.Page.getControl(“
fieldName”).setFocus(true);
Disable/Enable field
Xrm.Page.getControl(fieldName).setDisabled(true);
Xrm.Page.getControl(fieldName).setDisabled(false);
Stop an on save
event
event.returnValue
= false;
Return array of
strings of users security role GUIDs
Var
arrUserRoles = Xrm.Page.context.getUserRoles();
Get record GUID
var
recordId = Xrm.Page.data.entity.getId();
var
recordIdWithoutCurlyBraces = Xrm.Page.data.entity.getId().substring(1,37);
Get Organization
unique name
var
OrganizationUniqueName = Xrm.Page.context.getOrgUniqueName();
Gets current user
Guid
var
userGUID = Xrm.Page.context.getUserId();
Returns the base URL
that was used to access the application.
var
clientURL = Xrm.Page.context.getClientUrl();
Returns a string current Microsoft Office Outlook theme chosen by the user.
var
currentTheme = Xrm.Page.context.getCurrentTheme();
Returns whether
Autosave is enabled for the organization.
var
isAutoSaveEnnabled = Xrm.Page.context.getIsAutoSaveEnabled();
Returns the Dynamics 365 Language Pack that is user's preferred language.
var userLCID = Xrm.Page.context.getUserLcid();
Returns the name of the current user
var userLCID =
Xrm.Page.context.getUserName();
Returns the version number of the Dynamics 365 server
var currentVersion =
Xrm.Page.context.getVersion();
Method to close the form.
Xrm.Page.ui.close();
Method to get the form type of the record.
Xrm.Page.ui.getFormType();
Method to refresh the ribbon.
Xrm.Page.ui.refreshRibbon();
Returns the difference between the local time and Coordinated Universal
Time (UTC).
var timeDifference =
Xrm.Page.context.getTimeZoneOffsetMinutes();
Set Form Notifications in Dynamics 365
No comments:
Post a Comment