Sometimes when building forms you are going to run into a situation where you may need to set or remove the business requirement of an attribute on a form. This comes in handy when you are using multiple forms for different types of users. For instance, a salesmen may only need the ability to add basic customer information on one screen, but on another screen you may have information not visible to the salesman, such as financial information. This financial information may include fields that MUST be entered by the finance folks. So, what you do in these situations is remove the requirement at the attribute level and add the following code to a page load event on your page:
0 Comments
6/25/2012 UPDATE: This new version will work in either Header, Footer, Body or all!
In the post we are going to take a look at licking a problem that I have with Microsoft Dynamics CRM 2011. That is adding buttons to a form to perform some sort of action. There are several ways of firing script such as onchange of fields or even adding buttons to the ribbon bar. The ribbon bar is pretty interesting way of adding functionality, if you have the time download the definitions, find the exact spot and order you want your button, then finally re-import it. Its a cool feature and these new buttons are available for all forms for the entity, but it is overkill for simple things. This post will show you how to quickly add buttons to a page with just a few lines of javascript. By default, if a field on your form is disabled, it will not save any changes made via script. In these cases you need to specifically change its submit mode as follows:
1 Xrm.Page.getAttribute("new_attributename").setSubmitMode("always"); Pure and simple! |
AuthorBrian Greig Archives
August 2013
Categories
All
|