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
chfoslichfosli 

How to get Field Service Dispatcher/Resource license in scratch org

We need "Field Service Dispatcher", "Field Service Mobile" and "Field Service Scheduling" license in scratch org in order to utilize the FSL managed package.

We have tried to install the FSL managed package in a scratch org, and set up FSL, but we are stopped when trying to create the permission sets for Dispatcher and Resource, as we are missing the Field Service Dispatcher and Resource licenses in the scratch orgs.

Is there any way to include these licenses in scratch orgs, for example through the "features"-property in the project-scratch-def.json file? When you add the feature FieldService you only get the Field Service Standard licens.
Best Answer chosen by chfosli
chfoslichfosli
According to Salesforce Support, this is working as designed. I'm pushing on them to get this updated so we can have all the licenses we need in a scratch org.

All Answers

VinayVinay (Salesforce Developers) 
Hi,

Try below in your project-scratch-def.json file.
 
{
    "features": ["FieldService"],
    "settings": {
        "fieldServiceSettings": { "fieldServiceOrgPref": true }
    }
}

Review below link.

https://salesforce.stackexchange.com/questions/195844/activate-field-service-lightning-feature-in-a-salesforce-dx-scratch-org

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
Vinay Kumar
chfoslichfosli
We have that enabled, and "features": ["FieldService"] gives you the basic license Field Service Standard, but not any of the other license you need to set up the FSL-app. Se more details her: https://help.salesforce.com/articleView?id=pfs_get_started.htm&type=5
Ying01 ZhangYing01 Zhang
@chfosli , have you solved this problem yet ? I have the same problem
chfoslichfosli
Nope, still investingating it.
chfoslichfosli
According to Salesforce Support, this is working as designed. I'm pushing on them to get this updated so we can have all the licenses we need in a scratch org.
This was selected as the best answer
chfoslichfosli
Final response from support is that it is not supported, and there are now plans to support it.
Bradford MarBradford Mar
@chfosli, Did you get it working? I'm using this scratch def:
{
  "orgName": {org name},
  "edition": "Developer",
  "features": [
    "FieldService:5",
    "FieldServiceDispatcherUser:{number of licenses needed}",
    "FieldServiceMobileUser:{number of licenses needed}",
    "FieldServiceSchedulingUser:{number of licenses needed}"],
  "settings": {
    "fieldServiceSettings": {
      "fieldServiceOrgPref": true,
      "enableWorkOrders": true
    }
  }


Then you have to install the two FSL managed packages:

sfdx force:package:install --package 04t0M000001i20fQAA --apexcompile package --securitytype AllUsers --noprompt --wait 15 -u {org alias}
sfdx force:package:install --package 04t1R0000016YZtQAM --apexcompile package --securitytype AllUsers --noprompt --wait 15 -u {org alias}
Finally, you have to open the org and go to FSL Admin > FSL Settings > Permission Sets to generate all of the perm sets.  You might encounter some bugs here, but there are workarounds like so: https://trailblazer.salesforce.com/issues_view?id=a1p4V0000003vypQAA

Then you should be set. I haven't tried this with an Enterprise edition yet because I couldn't add more than 1 FSL license there for some heretofore unknown reason.
Bradford MarBradford Mar
FYI - you can replace "FieldService:5" with the number of total FSL licenses you'll need.
HAREESH CHENNURUHAREESH CHENNURU
@Bardford Mar

I was able to create a scratch org with FSL features and added 5 licenses of FSDispatchUser, FSMobileUser, FSSchedulingUser to a developer org.
Just ensure you update the features and settings in the definition file in the Config folder within your project file.
User-added image
Brian Watts 21Brian Watts 21

Why can I find zero information about FSL re: how to manage particulars using SFDX and the CLI?

This is the first page I've found with critical details after nearly a week of searching

chfoslichfosli

@Brian Watts 21. We have been working 2 years now with FSL, SFDX, Scratch orgs, etc. If you need some tips, just contact me or post a new question on this forum.