function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Throwing error on clicking Save



I have a requirement like when the Customer Portal user edits his personal information an message should be displayed saying "This will not update the Contact Information. This will update only the user information". But there should be some way where the user should save the details updated in the personal information.


So, I decided to keep a checkbox field so that when the user saves an error message will be shown and asking the user to check the checkbox and click save.


But later i realized that custom fields of user object are not visible for Customer portal user when he tries to update his personal information. 


Is there any other alternative for this requirement.


Any suggestions will be helpful.

Here is the code I am trying

trigger checkcontactupdation on User (before update) { Boolean contactnotupdated=true; for(User u:trigger.New){ if(u.Id==UserInfo.getuserId() && u.ContactId!=null){ if(u.Contact_will_not_be_updated__c==true) u.Contact_will_not_be_updated__c.adderror('This will not update the contact information. Confirm this by checking this checkbox and then Click on Save'); else{} } } }






apply a valdation rule to stop saving it.


if you click on both checkboxes do you want to save it.


Can you be a little more clear