You need to sign in to do that
Don't have an account?
Cannot change user profile
In some cases I need to change a user's profile programmatically. Have an Apex method the tries to do this, but I get the following message (running as myself, sys admin role).
{faultcode:'soapenv:Client', faultstring:'System.DmlException: Update failed. First exception on row 0 with id 00580000001r5gRAAQ; first error: FIELD_INTEGRITY_EXCEPTION, This user is a portal administrator and must have a profile with the "Edit Self-Service Users" permission.: __MISSING_LABEL_FOR_common.udd.impl.UddInfoImpl@1d09706: [UserPermissions]
At first I was invoking the method that changes the profile from a VF page. After reading the following in the Apex Dev Guide I switched it to a Webservice method and invoked from javascript, hoping it would somehow bypass whatever restriction I was running into. It didn't help.
"Invoking a custom webService method always uses System context. Consequently, the current user's credentials are not used..."
&
"Apex class methods that are exposed through the API with the webService keyword do not observe object permissions, field-level security, or sharing rules for any records..."
Can anyone suggest a way to work around this limitation restriction?
Thanks.
Thank you for the response. In my haste to post this question, I didn't send the correct error. I've been rerunning this different ways and had sent the message I get when running as myself (sys admin). When I run as a typical end user with limited rights I get the following message, which is the one I'm having trouble with.
{faultcode:'soapenv:Client', faultstring:'System.DmlException: Update failed. First exception on row 0 with id 00580000002LxloAAC; first error: FIELD_INTEGRITY_EXCEPTION, This profile is used by a user who is a delegated admin and must have the view setup permission: Profile ID: [ProfileId]
I have no delegated admins setup in our org, so I'm confused by the message. (Also turned on view setup perms, just to see, but made no diff.)
Thanks again.