9

I am struggling to figure out how to -- or if it's even possible to -- create a DX scratch org with the "Field Service Lightning" (FSL) feature installed. Based on the feature list here I'm guessing the answer is no and I'll just have to wait. But I'm not sure I'm interpreting that source correctly or missing something entirely since I'm just wrapping my head around DX.

Background: we have a production org with FSL installed and active, along with it's accompanying managed packages. I can create sandboxes from it and do development using standard Metadata API tools, but I was hoping to start a new project using DX. But I'm stuck configuring a scratch org with the proper features.

2 Answers 2

7

I heard from the DX team that as of today (October 2017), this is not possible, as I suspected. However, I was told that it is possible via a new process called "shape orgs", which is currently in pilot.

3
  • Do we know when shape org will be GA?
    – Mystery
    Commented Jul 2, 2018 at 9:13
  • No, no new information since the Spring '18 release notes, which stated: "Org Shape for Scratch Orgs Pilot Has Been Suspended. Removed information regarding how to sign up for the Org Shape for Scratch Orgs pilot. Due to outstanding bugs, we aren’t accepting any new pilot participants." Commented Jul 2, 2018 at 14:38
  • FWIW - FSL is still not working in my "preview" Winter '20 scratch org. I can turn it on manually after creating the org. I do not know of a method programmatically
    – bkwdesign
    Commented Sep 20, 2019 at 15:50
3

Salesforce has updated their syntax for some features. This is now possible if you specify the feature, values for those features, and settings in your project-scratch-def.json file like so:

{
    "features": ["FieldService:1"],
    "settings": {
        "fieldServiceSettings": { "fieldServiceOrgPref": true }
    }
}

This allocates 1 Field Service Lightning license to your scratch org.

You can find the list of features and values at the Salesforce documentation here.

5
  • 1
    You can also automate to further install the Field Service managed packages after you create a scratch org with with the above scratch definition: sfdx force:package:install --package [pacakge id] --apexcompile package --securitytype AllUsers --noprompt --wait 15 -u [org alias] using these ids: 04t0M000001i20fQAA (FSL Package) - 04t1R0000016YZtQAM (Salesforce Field Service App Package) Commented Jan 13, 2020 at 14:21
  • Using the markup above in my projectc-scratch-def.json gives me the following error: The feature value FieldService requires a quantity.
    – bkwdesign
    Commented Jan 29, 2021 at 4:28
  • 1
    @bkwdesign I have edited my answer to reflect the updated syntax. You just have to provide a value with field service to tell it how many licenses you want.
    – Kyle
    Commented Feb 1, 2021 at 21:52
  • Thank you @Kyle. I saw this in the SF docs but didn't have the reputation here to edit your anwer. I'm noticing your SF architect credentials. Would you mind augmenting either your answer, or simply here in the comments: What the need is for a number of licenses? As a dev-head who is not as connected to the functional side of things as much, I can't understand why my scratch org that is meant for trying things out needs to trifle with this detail. Isn't licensing a production concern?
    – bkwdesign
    Commented Feb 2, 2021 at 18:38
  • 1
    @bkwdesign Starting to get into 'outside of the scope of this question' territory but I'll bite. Scratch orgs can be used as a part of the dev lifecycle instead of a standard dev sandbox. In the case where you have a complicated scenario requiring two users with field service licenses on different profiles, as an example, it would be beneficial to be able to completely model the scenario in your scratch org while developing rather than relying on approximations.
    – Kyle
    Commented Feb 3, 2021 at 20:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .