Tuesday, 1 April 2014

CRM 2013 Javascript Special Functions


  • Xrm.Page.context.client.getClient() – Returns client type i.e. outlook, web or mobile.
  •  Xrm.Page.context.client.getClientState() – Returns client state i.e. online or offline.
  • Xrm.Page.data.refresh() – This is one interesting as it refreshes the data on the form without even reloading the page. This also enables developers to pass a callback method.
  • Xrm.Page.data.save() – Save the form
  •  Xrm.Page.data.getIsValid() – Returns true is form is valid for save else false
  •  Xrm.Page.data.setFormDirty() – Sets the form dirty for force save.
  •  Xrm.Page.data.entity.getPrimaryAttributeValue() – Returns the value of primary attribute
  • Xrm.Page.ui.setFormNotification(message,level,uniqueId) – Sets the notification on top of the form.
  • Xrm.Page.ui.clearFormNotification() – Clears the form notification
  • Xrm.Page.ui.refreshRibbon() – Refreshes the ribbon. This method does not work on CRM for tablets.
  •  Xrm.Page.getControl(“field_name”).setNotification(“Notification”) – Sets the notification for a specific field right next to the field label. This can often be used as a custom tool tip.
  • Xrm.Page.getControl(“new_name”).clearNotification() – Clears the notification
  •  Xrm.Page.getAttribute(“new_precision”).setPrecision(2) – Override field precision
  •  Xrm.Page.getControl(“createdon”).setShowTime(true) – Toggle show time at form
  •  Xrm.Page.getControl(“field_name”).addCustomFilter(fetchFilter, entityType) – Allows developer to add custom filter to a lookup view.
  • Xrm.Page.getControl(“field_name”).addPreSearch(handler) – adds pre trigger filter to the lookup.
  • Xrm.Page.getControl(“ownerid”).removePreSearch(handler) – removes the trigger
  •  Xrm.Utility.openWebResourceDialog(webResourceName, webResourceData, width, height) – opens a sepecified webresource as a web dialog window.

No comments:

Post a Comment