You need to sign in to do that
Don't have an account?
Travis Cooper 17
What permissions to allow Customer Community Plus User to update Username in Salesforce in Portal?
I need to allow the user to update their username in the portal. What permissions will the profile need in order to allow this change to occur?
At the moment I am getting a insufficient_access_on_cross_reference_entity error. In a trigger handler I am running the following code.
private void processUpdatedUserFields() {
Id loggedUserId = UserInfo.getUserId();
User currentUser = [SELECT Id, Name, Email FROM User WHERE Id =: loggedUserId];
for (User newUser : (List<User>) Trigger.new) {
User oldUser = (User) Trigger.oldMap.get(newUser.Id);
if (loggedUserId == newUser.Id && newUser.Email != oldUser.Email) {
system.debug(logginglevel.error, 'isUpdateable::: ' + Schema.sObjectType.User.fields.Username.isUpdateable());
newUser.Username = newUser.Email;
}
}
}
This is running beforeUpdate and used to run successfully.
Thank you.
At the moment I am getting a insufficient_access_on_cross_reference_entity error. In a trigger handler I am running the following code.
private void processUpdatedUserFields() {
Id loggedUserId = UserInfo.getUserId();
User currentUser = [SELECT Id, Name, Email FROM User WHERE Id =: loggedUserId];
for (User newUser : (List<User>) Trigger.new) {
User oldUser = (User) Trigger.oldMap.get(newUser.Id);
if (loggedUserId == newUser.Id && newUser.Email != oldUser.Email) {
system.debug(logginglevel.error, 'isUpdateable::: ' + Schema.sObjectType.User.fields.Username.isUpdateable());
newUser.Username = newUser.Email;
}
}
}
This is running beforeUpdate and used to run successfully.
Thank you.
What is the difference between the permissions that a future method uses and a without sharing class uses if any? Why would a future method work and not directly in the trigger?
I think your commuity user profile not able to access user object sothat you can not update this.
for this solution you need set permisson Read and Write for user object in community user profile.
if you need any assistanse, Please let me know!!
Kindly mark my solution as the best answer if it helps you.
Thanks
Mukesh
This should mean that the user has the correct Read/Write permissions on the user object, right?
get Describe:::
Schema.DescribeSObjectResult[getHasSubtypes=false;getIsSubtype=false;getKeyPrefix=005;getLabel=User;getLabelPlural=Users;getName=User;isAccessible=true;isCreateable=true;isCustom=false;isCustomSetting=false;isDeletable=false;isDeprecatedAndHidden=false;isFeedEnabled=true;isMergeable=false;isMruEnabled=true;isQueryable=true;isSearchable=true;isUndeletable=false;isUpdateable=true;]