locked
Custom Form - Read Only RRS feed

  • Question

  • We've created a custom child form that is linked off of the native CRM 2015 Order form. 

    When we submit the Order for integration into Dynamics GP (via the Connector 'Submit Order' button), the CRM Order status is changed to Submitted and the Order becomes read-only.  Therefore, we would like to ensure that our related custom form record is also read-only. 

    We added custom JavaScript to make all fields read-only, but the Delete/Deactivate button are still available. Rather than using JavaScript, we're now wondering if there is some status flag or system switch we can apply that easily turns a custom form into a read-only state and removes/prevents the user form deleting the record?

    Thank you

    Thursday, November 5, 2015 6:35 PM

Answers

  • Hi,

    You could hide the delete/deactivate buttons using the ribbon work bench. Set a bool field on the child entity when the order is read only and then have a go with script on the display of the buttons on that field.

    Takes a bit of digging in ribbon work bench but it isn't rocket science. That way you don't have to fiddle with plugins and uggly error messages.

    Regards


    Rickard Norström Developer CRM-Konsulterna
    http://www.crmkonsulterna.se
    Swedish Dynamics CRM Forum: http://www.crmforum.se
    My Blog: http://rickardnorstrom.blogspot.se

    • Marked as answer by Cipher Friday, November 6, 2015 7:27 PM
    Friday, November 6, 2015 3:40 PM

All replies

  • Is removing the delete privilege for the Order entity not an option?  Then only allow managers to have this privilege?  It would limit the record deletion.

    Jason Peterson

    Thursday, November 5, 2015 7:46 PM
  • Hi Jason,

    We only want the custom entity to be read-only, and not allow delete's, when the parent Order entity is read-only. 

    When the Order is available for editing/deleting then the custom entity should also be available for editing/deleting.

    Thursday, November 5, 2015 7:54 PM
  • Well Cipher you will have to write a couple of plugins for this.

    -First write a plugin on setstate of Order and get all custom entity records related to that Order and deactivate them by using setstaterequest.

    -Write a plugin on delete of the custom entity which will check the status of current custom entity record or the order related to the order and if found just throw an invalid pluginexecution exception thereby prevent the user from deleting the record.


    If this post answers your question, please click "Mark As Answer" on the post and "Vote as Helpful" Thank you, DT

    Friday, November 6, 2015 2:34 PM
  • Hi,

    You could hide the delete/deactivate buttons using the ribbon work bench. Set a bool field on the child entity when the order is read only and then have a go with script on the display of the buttons on that field.

    Takes a bit of digging in ribbon work bench but it isn't rocket science. That way you don't have to fiddle with plugins and uggly error messages.

    Regards


    Rickard Norström Developer CRM-Konsulterna
    http://www.crmkonsulterna.se
    Swedish Dynamics CRM Forum: http://www.crmforum.se
    My Blog: http://rickardnorstrom.blogspot.se

    • Marked as answer by Cipher Friday, November 6, 2015 7:27 PM
    Friday, November 6, 2015 3:40 PM
  • Hi Rikard,

    That's the approach we've actually taken for the button logic.  With all the fields already being set to read-only via JavaScript everything is now currently working as intended.

    However, we were hoping for a built in approach but, based on the responses I'm seeing here, Microsoft hasn't provided developers with a setting or function to easily make a form/record read-only, the same way it does with it's own records.  

    Hopefully, this is something that they add in the future.

     


    • Edited by Cipher Friday, November 6, 2015 7:27 PM
    Friday, November 6, 2015 7:27 PM