preOpenObject - Access property

Hello everybody,

I’m trying to access the noteditable property on the preOpenObject hook in order to change dynamically the status of a field.

Here is my code from startup.js

preOpenObject: function (obj, type) {
        console.log('object', obj);
        var objectType = obj.edit.dataFields.GroupingProperty.fieldConfig.noteditable
        console.log(objectType);
    },

GroupingProperty is a field.

When I run it, this is my result:

Any help would be highly appreciated.

Thank you.

If you change the fields before send it to browser you have to use custom EventListener (pimcore.admin.dataobject.get.preSendData, list all available admin events is https://github.com/pimcore/pimcore/blob/master/lib/Event/AdminEvents.php ). It modifies fields, property before show in browser. See for example https://pimcore.com/docs/6.x/Development_Documentation/Best_Practice/Modifying_Permissions_based_on_Object_Data.html - MyEventListener and access to the data and object.

Took me a while to revisit this topic. Thank you for the support.