Monday, December 31, 2012

Useful Javascript functions for CRM 2011

Hello everybody,

When we want to manipulate some objects in a Dynamics CRM 2011 entity form interactively, the first think that we think, is to use Javascript methods.

So, we start by searching some methods to manipulate an attribute, a navigation item ... And we waste many time to search on the internet if there is a method to do that thing or not ...

It is for this reason that I have gathered all the methods that I thought they may help the Dynamics CRM 2011 Developer in a one Javascript Library that I called FormHelper.

You can download this Library right here.

There is the list of Javascript Functions :

Usefull Information
  • GetServerUrl()
  • GetOrganisationName()
  • GetEntityId()
  • GetEntityName()
  • GetCurrentUserId()
  • GetCurrentUserRoles()
  • GetEntityOwnerId()
  • GetEntityState()
Managing Attributes
  • GetAttributeValue(attributeName)
  • SetAttributeValue(attributeName, attributeValue)
  • GetAttributeLabel(attributeName)
  • SetAttributeLabel(attributeName, label)
  • GetAttributeVisibility(attributeName)
  • SetAttributeVisibility(attributeName, visible)
  • GetAttributeRequirementLevel(attributeName)
  • SetAttributeRequirementLevel(attributeName, requirementLevel)
  • GetAttributeState(attributeName)
  • SetAttributeState(attributeName, disabled)
  • SetFocusOnAttribute(attributeName)
Managing Tabs, Sections & Nav Items
  • GetTabLabel(tabId)
  • SetTabLabel(tabId, newLabel)
  • GetTabDisplayState(tabId)
  • SetTabDisplayState(tabId, newTabState)
  • ManageTabVisibility(tabId, visible)
  • GetSectionLabel(tabId, sectionId)
  • SetSectionLabel(tabId, sectionId, newLabel)
  • ManageSectionVisibility(tabId, sectionId, visible)
  • GetNavItemLabel(navItemId)
  • SetNavItemLabel(navItemId, newLabel)
  • ManageNavItemVisibility(navItemId, visible)
Other Functions
  • IsIFrame(controlName)
  • IsSubgrid(controlName)
  • IsLookup(controlName)
  • IsOptionSet(attributeName)
  • GetIframeUrl(iframeId)
  • RefreshSubGrid(subgridId)
  • GetOptionSetText(attributeName)
  • SetLookupValue(attributeName, lookupId, lookupName, entityName)
  • ClearLookup(attributeName)
  • CallOnChangeEvent(attributeName)

I hope that this javascript functions can help you.

Have a nice day.
N.JL


No comments:

Post a Comment