Restricting attributes with persistence types to a protection level of Read Only

Version 2

    Environment: Service Desk 7.2.6 and 7.3.2

     

    When creating attributes with persistence types and adding them to a window the Protection Level should be set to read only automatically for you.  For example: When you add a datetime field with a createdatetime persistence type onto a window it should set the protection level to Read Only and you should not be able to override this.  This is correct as datetime fields being automatically populated with the timestamp of when the record is created should not be given the ability for the user to change it.

     

    However we’ve found that if you create a new datetime attribute with a persistence type of create date, when you add it to the window you are able override the Protection Level.  If you don’t change anything it will leave the protection level as NULL and then you are able to change the date field when entering data into this window.  I’ve attached some screenshots illustrating what I mean.

     

    In order to correct this so that there is no room for forgetting to set the protection level correctly:

     

    • Take a backup and then run the MDM against the database.
    • This will correct the attributes themselves (flag them as md_is_readonly = 1 in the md_attribute_type table) but will not correct the windows that the attributes are already on.
    • If you only have one or two windows that have this issue worried about then remove the attribute off the window in window manager and then re-add it.  Then the protection level  will be correctly set.
    • Alternatively you can run the statement below to correct the windows:

     

    UPDATE ui_form_item 
    set ui_protection_level = '3' 
    where ui_protection_level is null 
    and ui_attribute_type_guid IN (SELECT md_guid FROM md_attribute_type WHERE md_defined_by = ‘2’ AND (md_persistence_flags IN ('128', '8', '512', '16', '4', '256')))