With release of CRM 2013, Microsoft has added some new methods that can be accessed. In the past, we had to write some unsupported JavaScript to get this functionality. More information about all these methods can be found in Microsoft Dynamics CRM 2013 SDK.
• 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.
can you pls provide sampe code for Xrm.Page.getControl(“ownerid”).removePreSearch(handler)?
Hi Vey,
I think removePreSearch will not work on owner lookup.
You can visit here
http://crmjavascripts.blogspot.in/2014/04/how-filter-lookup-in-crm-2013.html
Amazing Article it contained depth and was quite unique…
I’ve struggled with this also. The function handler you put in the addPreSearch method must be used in the removePreSearch. What i’ve done is make a cache which stores the functions per attribute-control. When an add is done the handler is stored. On removePreSearch you search in the cache for the correct attribute-control and in this way the correct handler. This function handler must be passed in the removePreSearch
Hope this helps you
Do you have any sample code for this function Xrm.Page.getControl(“ownerid”).removePreSearch(handler)? I couldn’t make get this function work properly.
I do not have a sample code for this but please make sure that you are running this method for updated entities in CRM 2013. There is a list of updated entities in SDK.
Ashish