Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to make User profile fields non editable on the Service portal, Fields like Department, Location etc

prabu_vela
Tera Contributor

service portal.PNG  

3 REPLIES 3

Vishal Khandve
Kilo Sage

Hi Prabu,


You can write a Client script :



There you can select UI type as Mobile/Service Portal.



It will only run on Service Portal.



Thank you,


vishu


uddandinirosha
Giga Contributor

You need to clone the widget


1.clone widget name :user profile


2.add code next to the filed you want 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.add this cloned widget to page name : user profile through designer


4.test it


Hi,

 

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!