0

I'm trying to create a user in a scratch org through SF CLI using force:user:create and a user-def.json file. Here is a sample body request according to Salesforce documentation:

{
    "Username": "tester1@sfdx.org",
    "LastName": "Hobbs",
    "Email": "tester1@sfdx.org",
    "Alias": "tester1",
    "TimeZoneSidKey": "America/Denver",
    "LocaleSidKey": "en_US",
    "EmailEncodingKey": "UTF-8",
    "LanguageLocaleKey": "en_US",
    "profileName": "Standard Platform User",
    "permsets": ["Dreamhouse", "Cloudhouse"],
    "generatePassword": true
}

Nothing is mentioned in the doc how to select the user license. By default it seems that the user license is Salesforce Platform. So when I try to create a user with a custom profile(i.e.: Sales User) linked to a Salesforce license instead, I'm getting the following error :

ERROR:  There are no available user licenses for the user profile "Sales User".

Could someone point me to the right direction.

  • 1
    The license is based off of the profile. You've probably used up all your available licenses (check in the setup -> company info). I think you only get 2 (after the admin) – Aequitas Mar 7 '18 at 5:29
  • 1
    This: <userLicense>Salesforce</userLicense> is the line in the profile that determines which license the profile is for. – Aequitas Mar 7 '18 at 5:33
  • Actually in a way you were right, I'm limited to 5 user licenses in Enterprise Scratch Org. Originally I tried to create my users manually in the scratch org and I had some unknown error please contact Salesforce blabla. But it actually created the users anyway a few minutes after that. So when I tried from CLI, no more available licenses. Make sense. Thank u – Cloud Ninja Mar 7 '18 at 5:58
  • Yeah, I had the exact same thing, errors on creating the user, but it still created them and then when I fixed the error I got an out of licenses error. – Aequitas Mar 7 '18 at 5:59

Your Answer

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

Browse other questions tagged or ask your own question.