CRM 2015 Client API
Xrm.Utility
Xrm.Page.data
Parameters
Description
alertDialog
message,onCloseCallback?
confirmDialog
message,yesCloseCallback?,noCloseCallback?
Displays a dialog box containing an applicationdefined message.
Displays a confirmation dialog box that contains an
optional message as well as OK and Cancel buttons.
isActivityType
entityName
Determine if an entity is an activity entity.
openEntityForm
name,id?,parameters?,windowOptions?
Opens an entity form for a new or existing entity
record using the options you set as parameters.
windowOptions is only available 2015 Online
Update 1+
openQuickCreate callback?,entityLogicalName,createFromEntity?, Opens a new quick create form. 2015 Online Update
parameters?
1+
openWebResource webResourceName,webResourceData?,width?, Opens an HTML web resource. Does not work on
height?
Tablets
Xrm.Page
Xrm.Page.data.entity
Parameters
Description
refresh
save?
save
saveOptions?
Asynchronously refreshes and optionally saves all the
data of the form without reloading the page.
Saves the record asynchronously. saveOptions is only
available 2015 Online Update 1+
then
successCallback?, errorCallback?
Method is appended to above calls.
Xrm.Page.data.entity attribute/Xrm.Page.getAttribute
Parameters
Description
Parameters Description
attributes
A collection of all the entities attributes/fields
getDataXml
getEntityName
Returns a string representing the XML that will be sent to the
server when the record is saved. Does not work on Tablets
Returns the logical name of the entity for the record
getId
Returns the id value for the record.
getIsDirty
Returns a bool that indicates if any fields have been modified.
addOnSave
Adds a function to be called when the record is saved.
removeOnSave
Removes a function to be called when the record is saved.
getPrimaryAttributeValue
Gets a string for the value of the primary attribute of the entity
controls
A collection of all the controls representing the attribute.
getAttributeType
Returns a string value that represents the type of attribute.
getFormat
Returns a string value of formatting options for the attribute.
getIsDirty
Returns a bool that indicates if there are unsaved changes.
getActiveProcess
save
action?
Xrm.Page.data.process
Parameters
Description
getMaxLength
getAttribute
schemaName
Retrieves an attribute from the Xrm.Page.data.entity.attributes
collection
getName
Returns a number indicating the max length of a string or
memo.
Returns the logical name of the attribute.
getControl
Id
Retrieves a control from the Xrm.Page.ui.controls collection.
getParent
Returns the Xrm.Page.data.entity object.
setActiveProcess
getUserPrivilege
getActiveStage
addOnChange
Returns an object with 3 bools indicating privileges of create,
read, and update.
Sets a function to be called when the value is changed.
removeOnChange
Removes a function from the OnChange event.
Causes the OnChange event to occur.
Xrm.Page.context
Parameters Description
client.getClient
Returns a value to indicate which client the script is executing in.
fireOnChange
client.getClientState
Returns a value to indicate the state of the client.
setRequiredLevel
getClientUrl
Returns the base URL what was used to access the application.
getRequiredLevel
getCurrentTheme
Returns a string representing the current Microsoft Office Outlook theme
chosen by the user.
Returns whether Autosave is enabled for the organization.
setSubmitMode
Returns the LCID value that represents the base language for the
organization.
Returns the unique text value of the organizations name.
setValue
getIsAutoSaveEnabled
getOrgLcid
getOrgUniqueName
getQueryStringParameters
Returns a dictionary object of key value pairs that represents the query
string arguments that were passed to the page.
Returns the difference between the local time and Coordinated Universal
Time (UTC).
Returns the GUID of the SystemUser.Id value for the current user.
getTimeZoneOffsetMinutes
getUserId
getUserLcid
Returns the LCID value that represents the Language Pack that the user
selected as their preferred language.
Returns the name of the current user.
getUserName
getUserRoles
prependOrgName
sPath
Returns and array of strings that represent the GUID values of each of the
security roles that the user is associated with or any teams the user is
associated with.
Prepends the organization name to the specified path.
Collections
Sets the data value for an attribute.
Retrieves the data value for an attribute.
getInitialValue
getOption
Returns the value set when the form opened.
getOptions
Returns an option object with the value matching the
argument passed.
Returns an array of option objects.
getSelectedOption
Returns the option object for the selected option.
getText
Returns the text value of the currently selected option.
value
Number
setActiveStage
Description
Returns a Process object representing the active process.
processId,
callbackFunction?
Set a process as the active process.
Returns a Stage object representing the active stage.
stageId,
callbackFunction?
getEnabledProcesses
callbackFunction
moveNext
callbackFunction?
Set a completed stage for the current entity as the active
stage.
Returns a collection of stages for the current, branched
BPF.
Asynchronously returns enabled BPFs. Callback must
accept object.
Progresses to the next stage.
movePrevious
callbackFunction?
Moves to the previous stage.
getActivePath
addOnStageChange
Sets a function to be called when stage is changed.
removeOnStageChange
Removes a function from the OnStageChange event.
addOnStageSelected
Sets a function to be called when stage is selected.
removeOnStageSelected
Removes a function from the OnStageSelected event.
Process
getId
Returns the ID of the process.
getName
Returns the name of the process.
getStages
Returns a collection of Stages.
isRendered
Returns true if the process is rendered, false if not.
Stage
getMax
Returns a number indicating the max allowed value.
getMin
Returns a number indicating the minimum allowed value.
getEntityname
Returns an object with a getValue method to return the
integer value of the category
Returns the logical of the associated entity.
getPrecision
Returns the number of digits to the right of the decimal
point.
getId
Returns the ID of the stage.
getName
Returns the name of the stage.
getStatus
Returns the status of the stage.
getSteps
Returns a collection of steps in the stage.
forEach
delegate function
Apply an action in a delegate function to each object in the
collection.
getIsPartyList
get
value
Get one or more objects from the collection.
Parameters
Returns a string indicating the requirement level for an
attribute.
Sets when the data will be submitted
(always,never,dirty).
Returns a string indicating when the data will be submitted.
OptionSet/Boolean
Lookup
Execution Context
value
getValue
Description
Gets the number of items in the collection.
submitMode
getSubmitMode
Parameters
getLength
requirementLevel Sets whether data is required, recommended, or none.
Parameters
Saves the record synchronously with the option to close or
open a new form after completed.
Returns a bool that indicates if the lookup is a partylist.
getCategory
Steps
getAttribute
GetGlobalContext
getName
Returns the logical name of the attribute associated with
the step.
Returns the name of the step.
isRequired
Returns whether the step is required in the BPF
Description
getContext
Returns client-side context object.
getDepth
Returns a value indicating when the handler is executed.
getEventArgs
Returns an object with methods to manage the Save event.
getEventSource
Returns a reference to the object that the event occurred on.
getSharedVariable
Returns a variable set using setSharedVariable.
setSharedVariable
Sets the value of a variable to be used by the next handler.
ClientGlobalContext.js.aspx
Xrm.Page.ui tab
Xrm.Page.ui
Parameters
Description
Parameters
close
Method to close the form.
getDisplayState
controls
A collection of all the controls on the page
setDisplayState
formSelector.items
getFormType
A collection of all the form items accessible to the current
user.
Method to return a reference to the form currently being
shown.
Method to get the control object that currently has focus on
the form.
Method to get the form context for the record.
navigation.items
A collection of all the navigation items on the page
formSelector.getCurrentItem
getCurrentControl
setFormNotification
message, level, uniqueId Use this method to display form level notification.
clearFormNotification
uniqueId
refreshRibbon
Use this method to remove form level notifications
Xrm.Page.ui.navigation item
Description
getId
Returns the name of the item.
Sets the tab to be collapsed or expanded.
getLabel
Returns the label for the item.
getName
Returns the name of the tab.
setLabel
getParent
Returns the Xrm.Page.ui object.
setFocus
Sets the focus on the item.
getLabel
Returns the tab label.
getVisible
Returns a value that indicates whether the item is visible.
Sets the label for the tab.
setVisible
string
string
sections
A collection of all the sections in the tab.
setFocus
Sets the focus on the tab.
getVisible
Returns a value that indicates whether the tab is visible.
setVisible
bool
Sets a value that indicates whether the tab is visible.
Xrm.Page.ui section
tabs
Method to cause the ribbon to re-evaluate data that controls
what is displayed in it.
A collection of all the tabs on the page.
getViewPortHeight
Method to get the height of the viewport in pixels
controls
A collection of controls in the section.
getViewPortWidth
Method to get the width of the viewport in pixels
getName
Returns the name of the setction.
getParent
Returns the tab containing the section
getLabel
Returns the section label.
Parameters
Parameters
getDisabled
setDisabled
bool
Description
Description
Returns a value that indicates whether a tab is collapsed or expanded.
setLabel
Xrm.Page.ui control/Xrm.Page.getControl
Parameters
setLabel
Returns whether the control is disabled.
getVisible
Sets whether the control is disabled.
setVisible
string
Description
Sets the label for the section.
Returns a value that indicates whether the section is visible.
bool
string
Sets the label for the item.
bool
Sets a value that indicates whether the item is visible.
Xrm.Page.ui.formSelector item
Parameters
Description
getId
Returns the ID of the form.
getLabel
Returns the form label.
navigate
Opens the specified form.
Xrm.Page.ui.process
Parameters
Description
setDisplayState
strExpanded
Sets the BPF control to be collapsed or expanded.
setVisible
boolVisible
Sets the BPF control to be visible or hidden.
Save event arguments
Parameters
Sets a value that indicates whether the section is visible.
Description
getAttribute
Returns the attribute that the control is bound to.
getSaveMode
Returns a value indicating how the save event was initiated.
getControlType
Returns a value that categorizes controls.
isDefaultPrevented
getName
Returns the name assigned to the control.
SubGrid
getParent
Returns a reference to the section object that contains
the control.
Returns the label for the control.
Returns a value indicating whether the save event was canceled
because of the preventDefault method.
Cancels the save operation, but all remaining events will be executed.
refresh
getLabel
GridControl
Parameters
Description
Refreshes the data displayed in the subgrid.
2015 Online Update 1+
setLabel
label
Sets the label for the control.
addOnLoad
Used to add event handlers to the OnLoad event.
setNotification
message,uniqueId
Display a message near the control for invalid data.
getContextType
Returns context information about the control.
clearNotification
uniqueId
Remove a message already displayed for a control.
getEntityName
getVisible
setVisible
bool
setFocus
addCustomView
Returns the logical name of the entity data displayed.
1 Create (and Quick Create)
2 Save and Close
Returns a value that indicates whether a control is visible. getGrid
Returns the Grid object available in the control.
2 Update
59 Save and New
Sets whether the control is visible.
getViewSelector
Returns the ViewSelector object available in the control.
3 Read Only
70 AutoSave
Sets the focus on the control.
removeOnLoad
Removes event handlers from the OnLoad event.
4 Disabled
58 Save as Completed
Adds filter to the results displayed in the lookup.
2015 Online Update 1+
Returns a collection of every GridRow in the Grid.
getSelectedRows
Returns a collection of every selected GridRow in the Grid.
getDefaultView
viewId,entityName,viewDisplayNa Adds a new view for the lookup dialog box.
me,fetchXml,layoutXml,isDefault
Returns the ID value of the default lookup dialog view.
getTotalRecordCount
Returns the total number of records in the Grid.
setDefaultView
viewGuid
Sets the default view for the lookup dialog box.
GridRow
Used to apply changes to lookups based on values when
the user is about to view results.
Removes a function from the PreSearch event.
getData
removePreSearch
option,[index]
clearOptions
removeOption
number
getShowTime
setShowTime
bool
Returns the logical name for the record in the row.
getEntityReference
Returns a lookup object for the record in the row.
getId
Returns the id for the record in the row.
getPrimaryAttributeValue
Returns the primary attribute value for the record.
WebResource
getData
setData
Returns a reference to the current view.
isVisible
Returns true if view selector is visible, false if not.
viewSelectorItem
string
Sets the value of the data query string parameter.
ViewSelectorItem
2015 Online Update 1+
getEntityReference
string
Returns the object in the form that represents the web
resource.
Sets the URL to be displayed.
Returns the current URL being displayed.
IFrame
getObject
string
Adds an event handler to the OnResultOpen event.
addOnSelection
Adds an event handler to the OnSelection event.
removeOnSelection
Returns the current URL being displayed.
setSearchQuery
context
data
entity
process
attribute
Process
ui
navigation
tab
item
process
2015 Online Update 1+ Requires Parature integration
addOnResultOpen
Sets the URL to be displayed.
Page
Sets the current view.
Returns a lookup object for the view.
getSearchQuery
Returns the default URL than an Iframe control is
getSelectedResult
configured to display.
Returns the object in the form that represents an IFrame removeOnResultOpen
getInitialUrl
getSrc
getCurrentView
kbsearch
Utility
2015 Online Update 1+
setCurrentView
getSrc
setSrc
ViewSelector
2015 Online Update 1+
Returns the value of the data query string parameter.
getObject
setSrc
Returns the GridEntity for the GridRowData.
getEntityName
Sets whether a date control should show the time
portion.
15 Disqualify
Xrm
2015 Online Update 1+
Clears all options from an option set control.
Get whether a date control shows the time portion.
7 Send
Returns the GridRowData for the GridRow.
GridEntity
DateTime
47 Assign
16 Qualify
Adds an option to an option set control.
Removes an option from an option set control.
6 Reactivate
2015 Online Update 1+
getEntity
OptionSet
addOption
GridRowData
5 Deactivate
6 Bulk Edit
getRows
addPreSearch
Value Text
Value Text
1 Save
Grid
filter,entityLogicalName
.getSaveMode()
.getFormType()
0 Undefinied
Lookup
addCustomFilter
preventDefault
Stage
control
section
formSelector
Returns the text used as the search criteria.
Returns the currently selected result.
Removes a function from the OnResultOpen event.
Removes a function from the OnSelection event.
string
Sets the text used as the search criteria.
Steps
item