Home > CRM 2013 > New JScript syntaxes – CRM 2013

New JScript syntaxes – CRM 2013

With the advent of CRM 2013, below are the new set of client API methods

CRM 2013 Client API

CRM 2013 Client API


  • Xrm.Page.context.getUserName() Returns username of the currently logon user
  • Xrm.Page.context.getClient() Returns the client (i.e., Returns “Outlook”, “Web”, or “Mobile”)
  • Xrm.Page.context.client.getClientState()Returns  whether user is working online or offline.

Note – Xrm.Page.context.isOutlookOnline and isOutlookClient methods are deprecated


  • refresh data on form without reloading the page
  •, errorCallback) Allows you to save the record asynchronously with the option to set callback functions to be executed after the save operation is completed.
  • Validates the form and returns a Boolean.
  • – Allows to set IsDirty options on the form to (true/false).


  • Returns a string value of the primary attribute for the entity.


  • Xrm.Utility.openWebResourceDialog(webResourceName,webResourceData,width,height) Displays html web resource as dialogs window.
  • Xrm.Utility.alertDialog(message,onCloseCallback) Displays alert box with a callback function.
  • Xrm.Utility.confirmDialog(message,yesCloseCallback,noCloseCallback) Displays confirm dialog with different callbacks depending on Yes/No button clicks.

 Set Notifications

  • Check this link for syntaxes

Number Fields

  •      Xrm.Page.ui.controls.get(controlName).setPrecision(2) – Overrides field’s precision

Date Fields

  •    Xrm.Page.ui.controls.get(controlName).setShowTime(true) Controls whether to show the time for a date field.
  •    Xrm.Page.ui.controls.get(controlName).setIsAllDay()Allows to set the date control to all day date time.

Look up Fields

  •    Xrm.Page.ui.controls.get(controlName).addCustomFilter(filter,entityLogicaName)
    •    Applies a custom filter to the lookup view
    •    entityType is optional and if it is not passed it will default to all entity views
  •    Xrm.Page.ui.controls.get(controlName).addPreSearch(handler)Allows to add additional logic that will occur just before the search dialog box
  •   Xrm.Page.ui.controls.get(controlName).removePreSearch(handler)Removes event handler functions that previously been set in addPreSearch event.


Categories: CRM 2013 Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: