MSCRM 2011 Javascript Development Cheat Sheet

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Microsoft Dynamics CRM 2011 JavaScript Development Cheat Sheet

Xrm.Page.context Methods
getAuthenticationHeader getCurrentTheme getOrgLcid getOrgUniqueName getQueryStringParameters getServerUrl getUserId getUserLcid getUserRoles isOutlookClient isOutlookOnline prependOrgName Method addOnChange fireOnChange getAttributeType getFormat getInitialValue getIsDirty getMax getMaxLength getMin getName getOption getOptions getParent getPrecision getRequiredLevel getSelectedOption getSubmitMode getText getUserPrivilege getValue removeOnChange setRequiredLevel setSubmitMode setValue Returns the encoded SOAP header for MSCRM 4.0 style Web service calls Returns the current users Outlook theme Returns the LCID value for the base language of the organization Returns the unique organizations name Returns an array of key-value pairs representing the query strings Returns the base server URL Returns the current users SystemUser id Returns the LCID value representing the users preferred language Returns an array of GUID values of the security roles the user is associated with Returns a Boolean value indicating if the user is using Outlook client Returns a Boolean value indicating if the user is connected to the server while using MSCRM for Outlook with Offline Access Prepends the organization name to the specified path Description Sets a function to be called when the value is changed Causes the OnChange event to occur on the attribute Returns the type of attribute (string) Returns formatting options for the attribute (string) Returns the initial value for Boolean or optionset attributes Returns a Boolean value indicating if there are unsaved changes to the attribute value. Returns the maximum allowed value for an attribute (number) Returns the maximum length of an attribute (number) Returns the minimum allowed value for an attribute (number) Returns the logical name of the attribute Returns an option object by matching its name Returns an array of options for an optionset attribute Returns the parent object to the attribute Returns the number of digits allowed after the decimal point Returns a string indicating whether the attribute is required or recommended Returns the option selected in an optionset attribute. Returns a string indicating if the attribute will be submitted when the record is saved Returns the selected option for an optionset attribute Returns an array of Boolean values indicating if the user can create/read/update an attribute's values Retrieves the data value for an attribute Removes a function from the OnChange event handler Sets whether the attribute is required or recommended Sets whether the attributes data will be submitted Sets the data value for an attribute.

Daniel Cai http://danielcai.blogspot.com


Xrm.Page.ui.controls Collection Methods
forEach get Applies the action contained within a delegate function Returns one or more controls Argument Return Value Type None All the controls Array String The control that matches the name Object getLength Returns the number of controls in the collection. Description Adds a new view for the lookup dialog Adds an option to an Option set control Clears all options for an Option Set control Returns the attribute that the control is bound to Returns a value that categorizes controls Returns the data query string parameter passed to a Silverlight Web resource Returns the ID value of the default lookup dialog view Returns a value indicating whether the control is disabled Returns the label for the control Returns the name assigned to the control. Returns a reference to the section object that contains the control. Returns the current URL being displayed in an IFRAME. Returns the default URL of an IFrame control Returns the object in the form representing an IFrame or Web resource Returns a value indicating if the control is visible Refreshes the data displayed in a Sub-Grid Removes an option from an Option Set control Sets the data query string parameter passed to a Silverlight Web resource. Sets the default view for the lookup dialog Sets a value indicating whether the control is disabled. Sets the focus on the control. Sets the label for the control. Sets the URL to be displayed in an IFrame.

Xrm.Page.ui control methods


Method Control Types addCustomView Lookup addOption Option Set clearOptions Option Set getAttribute Standard, Lookup, Option Set getControlType All getData Silverlight Web resources getDefaultView Lookup getDisabled getLabel getName getParent getSrc getInitialUrl getObject getVisible refresh removeOption setData setDefaultView setDisabled setFocus setLabel setSrc setVisible addOnSave getDataXml getEntityName getId getIsDirty removeOnSave save All All All All IFrame, Web Resource IFrame IFrame, Web resource All SubGrid Option Sets

Xrm.Page.ui.navigation.items Collection Methods


forEach get Applies the action contained within a delegate function Returns one or more navigation items Argument Return Value Type None All the navigation items. Array String The item that matches the name Object Number The item that matches the index Object delegate function Any navigation items causing the Array (attribute, index) delegate function to return true getLength Returns the number of navigation items in the collection.

Xrm.Page.data.entity attribute Methods


Applicable All All All All boolean, optionset All money, decimal, integer, double string, memo money, decimal, integer, double All optionset optionset All money, decimal, double, integer All optionset All optionset All All All All All All

Xrm.Page.ui.formSelector members
Member items getCurrentItem forEach get Type Description Collection A collection of all accessible form items Method Returns the form currently being shown.

Xrm.Page.ui.formSelector.items Collection Methods


Applies the action contained within a delegate function. Returns one or more roleForms Argument Return Value Type None All the items. Array String The item that matches the name Object Number The item that matches the index Object delegate function Any items that cause the delegate Array (attribute, index) function to return true. getLength Returns the number of roleForms in the collection.

Silverlight Web resources Lookup All except Web Resources All All IFrame and Web Resource All Sets a value indicating if the control is visible Sets a function to be called when the record is saved Returns the xml string to be sent to the server when the record is saved Returns the logical name of the entity for the record Returns GUID id value for the record Returns a Boolean value indicating if any fields in the form have been modified Removes a function from the OnSave event hander Saves the record Closes the form. Returns the control that currently has focus Indicates the form context for the record Returns the height of the viewport in pixels Returns the width of the viewport in pixels Causes the ribbon to refresh

Xrm.Page.ui.tabs Collection Methods


forEach get Applies the action contained within a delegate function Returns one or more tabs Argument Return Value Type None All the tabs. Array String The tab that matches the name Object Number The tab that matches the index Object delegate function Any tabs that cause the delegate Array (attribute, index) function to return true. getLength Returns the number of tabs in the collection.

Xrm.Page.data.entity Methods

Xrm.Page.data.entity.attributes Collection Methods


forEach get Applies the action contained within a delegate function Returns one or more attributes Argument Return Value Type None All the attributes Array String The attribute matching the name Object Number The attribute matching the index Object delegate function Any attributes that cause the Array (attribute, index) delegate function to return true. getLength Returns the number of items in the collection.

Xrm.Page.ui Methods
close getCurrentControl getFormType getViewPortHeight getViewPortWidth refreshRibbon

Form Event Handler Execution Context Reference getContext Returns the Xrm.Page.context object getDepth Returns a value indicating the order in which this 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 Retrieves a variable set using setSharedVariable setSharedVariable Sets the value of a variable to be used by a hander after the current handler completes

Shortcut methods
Shortcut Equivalent Xrm.Page.getAttribute Xrm.Page.data.entity.attributes.get Xrm.Page.getControl Xrm.Page.ui.controls.get GetGlobalContext (Web Resources) Xrm.Page.context (within forms)

You might also like