question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Field Service not enabled in Scratch org even though it is enabled in scratch org definition file

See original GitHub issue

Summary

We have Field Service enabled in scratch org definition file, but yesterday it stopped working. Scratch org is created, but Field Service is not enabled. Other features are working fine.

This breaks a lot of CI/CD scripts, and it prevents us from making new package versions (most critical) since ore metadata has references to WorkOrder and ServiceAppointmen (and more). This objects are not available if Field Service is not enabled.

Steps To Reproduce:

  1. Create a empty sfdx project
  2. Use the following scratch org definition file: project-scratch-def.zip
  3. Run sfdx force:org:create -f config\project-scratch-def.json --setalias test --durationdays 1 to create scatch org

Expected result

Scratch org is created, and Field Service is enabled under Field Service Settings in Setup

Actual result

Scratch org is created, but Field Service is NOT enabled under Field Service Settings in Setup.

Additional information

SFDX CLI Version (to find the version of the CLI engine run sfdx --version): 7.85.1

SFDX plugin Version (to find the version of the CLI plugin run sfdx plugins --core): 50.16.1

OS and version: Windows 10

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jclark-dot-orgcommented, Mar 12, 2021

We started seeing this issue yesterday (March 11). According to our pipeline history, this was working as recently as March 8. Our scratch org definition file includes both

"features": [ "FieldService:25", ...]

and

    "settings": {
        "fieldServiceSettings": {
            "fieldServiceOrgPref": true
        },
        ...

As a workaround - we have an automated build script that:

  • creates the scratch
  • performs an MDAPI “pre-deploy” of a few items
  • installs a few managed packages, including FSL
  • force:source:pushes all source.

I found that adding FieldService.settings to the MDAPI pre-deploy does successfully enable FSL, which allows the FSL managed package (and subsequent source push) to succeed. My FieldService.settings is bare-minimum:

<?xml version="1.0" encoding="UTF-8"?>
<FieldServiceSettings xmlns="http://soap.sforce.com/2006/04/metadata">
    <fieldServiceOrgPref>true</fieldServiceOrgPref>
</FieldServiceSettings>
0reactions
chfoslicommented, Apr 23, 2021

The issue is now fixed and Field Service is now correctly enabled when you create a scratch org.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error creating scratch orgs with "Communities" enabled
I am following the steps listed here Build scratch org definition file in order to enable communities for a scratch org, but the...
Read more >
Scratch Org Features | Salesforce DX Developer Guide
Scratch Org Features. The scratch org definition file contains the configuration values that determine the shape of the scratch org. You can enable...
Read more >
How and Why to use Scratch Orgs for Development - YouTube
They should be used as examples for educational purposes only. Using any shown solutions in your own org is not advisable since they...
Read more >
Move to Salesforce DX more easily with Org Shape for Scratch ...
And when your Scratch Org is setup with Community enabled, ... And at the end of your Scratch Definition File journey, you'll end...
Read more >
Scratch Orgs And Create Scratch Org with Visual Studio Code ...
Once you've enabled the devhub, you'll have some objects automatically visible in your org like:- Active Scratch Orgs, Scratch Org Infos etc.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found