Read-only fields in the user profile widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2018 01:26 AM
I'd like to change some of the fields in the user profile widget to read-only while retaining the look-and-feel of the output. I've cloned the OOB user_profile widget and made the following change:
<div ng-repeat="fieldModel in getSysUserModelFields()">
<div class="list-group-item">
<div>
<sp-editable-field block="true" table="sys_user" editable-by-user="false" table-id="data.sysUserID" field-model="fieldModel"></sp-editable-field>
</div>
</div>
</div>
which works fine in that the fields can no longer be changed. However where a field has no data entered I don't get the header. For example when editable I get:
but when read-only I get:
Is there a way to display headers for all of the fields returned by getSysUserModelFields(), even if the option to edit them is set to false?
Also is there a way to selectively make a field read-only? For example you change change your phone number but not your email address?
Thanks.
- Labels:
-
Service Portal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-19-2018 06:47 AM
Hi @ibhavya,
Let's say you want to set sys_user.location as ReadOnly for end users, ie without Write rights.
Set write ACL on this field, with required roles or conditions who should be allowed to write.
It'll exclude write access on this field for users without these roles. And also, the sp-editable-field for this field in the user_profile Widget will return 'false' for those users.
Don't forget to keep access for allowed operators.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2018 01:57 AM
Ended up going a slightly different way which solved both the optional editing and the header display for empty fields:
<strong class="pad-right">{{ fieldModel.label }}</strong><br />
<span ng-if="fieldModel.name == 'email'"><sp-editable-field block="false" table="sys_user" editable-by-user="false" table-id="data.sysUserID" field-model="fieldModel"></sp-editable-field></span>
<span ng-if="fieldModel.name != 'email'"><sp-editable-field block="false" table="sys_user" editable-by-user="data.isLoggedInUsersProfile" table-id="data.sysUserID" field-model="fieldModel"></sp-editable-field></span>