Make Service portal User Profile Fields Readonly

Sabnam Memon
Tera Contributor

Hello,

I want to make Service portal User Profile Fields Readonly. I followed the below steps.

1.cloned widget name :user profile

2.added code next to the fields I wanted to make as readonly

for ex department


OOB: <p ng-if="::displayField('sys_user', 'department', true)"><strong class="pad-right">${Department}</strong><sp-editable-field editable-by-user="data.isLoggedInUsersProfile" table="sys_user" table-id="data.sysUserID" field-model="data.sysUserModel.department"></sp-editable-field></p>

 change :

<p ng-if="::displayField('sys_user', 'department', true)"><strong class="pad-right">${Department}</strong><sp-editable-field editable-by-user="false" table="sys_user" table-id="data.sysUserID" field-model="data.sysUserModel.department"></sp-editable-field></p>

 3.added this cloned widget to page name : user profile through designer

4.tested it

I followed the same steps. I am able to make the fields readonly. However, it gives me some error on the portal. Please see the attached screenshot. Do you know how I can resolve this error on the portal?

find_real_file.png

 

Thank you!

9 REPLIES 9

Kieran Jones1
Tera Expert

Are you sure you haven't edited other parts of the widget? I've just tested that solution by:

1. Cloned the OOB 'User Profile' widget

2. Swapped row 35 of the html with your changed row

3. Swapped the OOB 'User Profile' widget with the cloned one

Works. It is now read-only:

find_real_file.png

michaelj_sherid
ServiceNow Employee
ServiceNow Employee

Hi Sabnam,

This new widget would have created a Restricted Caller Access record and you would have to allow that execution. That may be the issue why it is not working for you. Check the Application Restricted Caller Access records that have a status of "Requested" or "Invalidated" that are related to the work you are trying to do.

Regards,

Mike

Hi Mike,

Let me check.

I noticed one more thing. If I comment line 80 in the server script it works. Doesn't give me error.  IS it okay to comment out this line?find_real_file.png

Thanks!

That will cause other issues and limit functionality. Have you checked the RCA table? That function is making a call that RCA would restrict.