Hi all
I have managed to remove field divs post render based on which user is logged in - Admin, assigned user or other user with no issue using the following:
this.$el.find('div[data-name="emailAddress"]').addClass('hidden');
Asking if there is a way to set a field (or fields) as read only - in other words, include the field as visible (do not hide using above code) but make it read only unless you are an admin or the assigned user. This would result in the record being able to be read, but only certain fields would be editable unless you are the record owner.
As an example we can use an opportunity record.
If you are Admin level or the assigned user - full access
If you are another user, you can see the record (some divs may be hidden as above), and if they choose edit they can change the close date and add another contact, but they can't change the account or amount or stage as these are dynamically set to read only.
So only some fields are "locked" - read only, and others can be edited. To my knowledge roles can not achieve this as it is all or nothing - you can't assign different permissions based on assigned user (hint hint for a new feature).
I am using Version 5.7.11 because my server requires MySQL5.6 for other projects.
Any suggestions? All input welcome.
Sorry should have mentioned this is in connection with https://docs.espocrm.com/development/custom-views/
I have managed to remove field divs post render based on which user is logged in - Admin, assigned user or other user with no issue using the following:
this.$el.find('div[data-name="emailAddress"]').addClass('hidden');
Asking if there is a way to set a field (or fields) as read only - in other words, include the field as visible (do not hide using above code) but make it read only unless you are an admin or the assigned user. This would result in the record being able to be read, but only certain fields would be editable unless you are the record owner.
As an example we can use an opportunity record.
If you are Admin level or the assigned user - full access
If you are another user, you can see the record (some divs may be hidden as above), and if they choose edit they can change the close date and add another contact, but they can't change the account or amount or stage as these are dynamically set to read only.
So only some fields are "locked" - read only, and others can be edited. To my knowledge roles can not achieve this as it is all or nothing - you can't assign different permissions based on assigned user (hint hint for a new feature).
I am using Version 5.7.11 because my server requires MySQL5.6 for other projects.
Any suggestions? All input welcome.
Sorry should have mentioned this is in connection with https://docs.espocrm.com/development/custom-views/
Comment