Question Status

Suggested Answer
CharlesWinn asked a question on 6 Mar 2015 11:42 AM

When a user select a record, ie: an account for an example, CRM put the user straight into edit mode.

With the auto save turned on, the user can  accidentally change the field without realizing it and the auto save will save it. One of the field this could happen is the yes/no field. With just a click, the user can change the field without realizing it.

I am trying to dummy proof the form so I am thinking of 2 solutions:

1. Having all the fields all locked down and then add an "Edit" button on the form which I will need to develop jscript code to unlock all the fields for editing and then the user has to press save to save the changes. Seems like a lot of works.

2. Having 2 difference forms. One locked down all fields . The other one is fully unlocked. Using the Edit button mentioned above, I can switches between the forms so the user will know that they are in the edit mode or not. Still have to press the Save button to save the record.

My question is how do I call difference forms on the button on the command bar?

Is there an easier solution to this scenario ? 

Thanks,

C.

 

Reply
Chitrarasan Duraisamy responded on 6 Mar 2015 11:54 AM

You can keep your auto save option , if you go with below option.

1. Add a onload function in case of form type is update and lock the all the fields  except one field may be checkbox . Keep this checkbox field in the top of the form. . 

2. If user wants to edit let user check the checkbox and onchange of that field unlock other fields for edit.

3. This way you will be adding just 4-10 lines of code without disabling the autosave.

You can use below script to disable edit

 Xrm.Page.ui.controls.forEach(function (control, index) { try { control.setDisabled(true); } catch (e) { } });

to enble edit use below code 

 Xrm.Page.ui.controls.forEach(function (control, index) { try { control.setDisabled(false); } catch (e) { } });

Chitra


Reply
Suggested Answer
Mahadeo Matre responded on 6 Mar 2015 12:53 PM

hi..

You can disable auto save for Account.. or when if any field is changed and auto saving.. you can alert user..

Here are the details on how to disable auto save for one entity.

blogs.msdn.com/.../how-to-manage-auto-save-for-individual-forms-of-entity.aspx

This link giving option to save record only when user click on SAVE button.

And here is how to disable auto save for complete organization.

blogs.msdn.com/.../manage-auto-save.aspx

Hope this will help..

Reply
Adam Vero responded on 6 Mar 2015 2:45 PM

Using multiple forms won't work very well. Once the user switches to the "edit" form, then the next record they open will also use this form, so you would need a script that then switches back to the "non-edit" form, which means a reload. Messy.

Possibly unlock fields using Business Rules or scripts.

In the case of two options fields, you can change how they appear to users- configure them to display as a picklist, since this requires two clicks to change a value rather than one (if they are set to checkbox or radio buttons - note that radio buttons is now displayed as a newfangled "toggle" field, of which I am not a fan).

Hope this helps. Adam Vero, MVP, MCT, MCTS:CRM 4.0, 2011, 2013

Reply
CharlesWinn responded on 6 Mar 2015 2:56 PM

Appreciate all the answers.

Adam,

That's exactly what I did.  Created a "Edit Mode" field (yes/no). Add business rule where edit mode = no, lock all field; else unlock all fields. Works great.

One note thought. In the business rule, if I included the " Parent account" as one of the field to lock/unlock, the whole business rule does not work. But if I remove the "Parent account" field out of the business rule, it works fine for the rest of all the fields on the form ... interesting. Wonder why? !!

Thanks all again,

C.

Reply
Adam Vero responded on 6 Mar 2015 3:13 PM

If you include any field in a Business Rule that is not on the form, then the whole rule fails validation and simply does nothing (it does not just fail the one action).

Check that you are selecting a field that is on the form, and not one that has perhaps been replaced with a custom field of the same name and/or purpose.

Hope this helps. Adam Vero, MVP, MCT, MCTS:CRM 4.0, 2011, 2013

Reply
Suggested Answer
Mahadeo Matre responded on 6 Mar 2015 12:53 PM

hi..

You can disable auto save for Account.. or when if any field is changed and auto saving.. you can alert user..

Here are the details on how to disable auto save for one entity.

blogs.msdn.com/.../how-to-manage-auto-save-for-individual-forms-of-entity.aspx

This link giving option to save record only when user click on SAVE button.

And here is how to disable auto save for complete organization.

blogs.msdn.com/.../manage-auto-save.aspx

Hope this will help..

Reply