17

I am using the nForce library with node.js. Everything seems to be right and we perform CRUD on the Case object.

However when we try to create a User using an external account with "Delegated External User Administrator" permission, the API returns the following message:

{errorCode: "INVALID_FIELD", messageBody: "No such column 'profileid' on sobject of type User", statusCode: 400, $get: function, $save: function…}

This is the data we sent to https://<org domain>/services/data/v30.0/sobjects/user using HTTP POST:

{
   "Username": "testapi@test.com",
   "LastName": "API",
   "Email": "testapi@test.com",
   "Alias": "testapi",
   "TimeZoneSidKey" : "America/Los_Angeles",
   "LocaleSidKey" : "en_US",
   "EmailEncodingKey" : "ISO-8859-1",
   "ProfileId" : "00e90000001a88W",
   "LanguageLocaleKey" : "en_US",
   "ContactId": "00390000013gwDS"
 }

How come there is no 'profileid' column? I can create a user using an internal admin account with the same set of data on the REST API.

Can a user with "Delegated External User Administrator" permission create a new external user through the REST API?

  • can the user do the delegated administration using the UI? – Mark Wochnick Aug 25 '14 at 20:49
  • 1
    User can do delegated administration through SF Community Portal – Oscar Tang Aug 26 '14 at 2:13
  • When I use a system admin account to login and create user using the same set of data, everything goes right. However a delegated external admin cannot do so. – Oscar Tang Aug 26 '14 at 2:58
  • 1
    Have you allowed the delegated user permissions to manage that profile? See help.salesforce.com/HTViewHelpDoc?id=networks_DPUA.htm for the example guide – pbattisson Sep 16 '14 at 15:42
  • 1
    I don't know whether you resolved this or not, but there's an example of how to use REST to create new users in one of the tutorials in the Security WorkBook. Perhaps if you went through that using a Community User as the test case instead of a Standard User, you'd be able to resolve your issue. – crmprogdev Nov 15 '14 at 14:55
1

If it's an issue, why don't you create a custom REST apex class?

here's a sample class and method:

@RestResource(urlMapping='/UserOperation/*')
global without sharing class RESTUserController {

    @HttpPost   
    global static String CreateNewUser(String Username,String LastName,String Email,String Alias,String TimeZoneSidKey,String LocaleSidKey,String EmailEncodingKey,String ProfileId,String LanguageLocaleKey,String ContactId) {
        User newUser = new User();
        newUser.Username = Username;
        newUser.LastName = LastName;
        newUser.Email = Email;
        newUser.Alias = Alias;
        newUser.TimeZoneSidKey = TimeZoneSidKey;
        newUser.LocaleSidKey = LocaleSidKey;
        newUser.EmailEncodingKey = EmailEncodingKey;
        newUser.ProfileId = ProfileId;
        newUser.LanguageLocaleKey = LanguageLocaleKey;
        newUser.ContactId = ContactId;
        insert newUser;
        return 'User Created! Id Is: ' + newUser.Id ;
    }
}
0

In this case, i'm think, error-message is clearly describe the problem. External customer don't have a permissions to see the profile object..

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_profile.htm#topic-title

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.