1

I'm strugging with the Field Service Lightning and how it blends with the SFDX story

Our business analyst is already cooking up a storm in a sandbox where she has FSL all working and configured.. so I'm just trying to prove I can bring over the metadata I sucked out of her sandbox, and recreate her FSL machinations in a different org

I have all our existing metadata successfully categorized into project layers that I may someday transfigure into 2GUP's - but for now, thanks to org shapes - I can usually successuflly capture anything and recreate it where I want via command line into a scratch org

So I have installed the Field Service Lighting managed package in my scratch org, using a couple of sfdx force:package:install commands:

SFDX Command Quick Description Grant Access (y/n) prompt
sfdx force:package:install --package 04t3y000001DfFqAAK -w 10 (FSL Spring 2022 236.0.52.1) --noprompt
sfdx force:package:install --package 04t4W000002PtX0QAK -w 10 (Salesforce Field Service Starter Kit)

I believe my project-scratch-def.json has the appropriate stuff in it:

{
  "orgName": "Core Scratch",
  "sourceOrg": "<< MY SHAPE ID >>", 
  "features": ["FieldService:2","Communities","Sites","MarketingUser","ServiceCloud","SalesUser","ServiceUser","ContactsToMultipleAccounts"],
  "description":"Customizations for Accounts, Leads, Contacts, Location, Opportunity with custom Territory Mgt. and Field Services",
  "adminEmail": "[email protected]",
  "settings": 
  {
    "fieldServiceSettings": { 
      "fieldServiceOrgPref": true ,
      "doesShareSaWithAr":true,
      "serviceAppointmentsDueDateOffsetOrgValue":7,
      "enableWorkOrders":true
    },
    "accountSettings": {
      "enableRelateContactToMultipleAccounts": true
    },
    "emailIntegrationSettings":{
      "enableContactAndEventSync": true,
      "enableProductivityFeatures": true,
      "doesGmailStayConnectedToSalesforce": true,
      "enableOutlookIntegration": true,
      "enableGmailIntegration": true,
      "isLayoutCustomizationAllowed": true,
      "doesEmailLogAsEmailMessageInOutlook": false,
      "shouldUseTrustedDomainsList": false,
      "enableEmailTrackingInMobile": true,
      "enableSupplementalContactInfoInMobile": false,
      "enableEngageForOutlook": true
    },
    "lightningExperienceSettings": {
        "enableS1DesktopEnabled": true
    },
    "mobileSettings": {
        "enableS1EncryptedStoragePref2": false
    },
    "pathAssistantSettings": {
        "pathAssistantEnabled": true
    },
    "chatterSettings": {
      "enableChatter":true
    },
    "apexSettings": {
        "enableCompileOnDeploy": false
    }
  }
}

However when I launch my scratch org, I'm noticing the permissions sets are still needing to be created. While I have the permissionsets source files (metadata) that I captured from our sandbox, but I have a feeling I'm doing something wrong. I'm not allowed to push this namespaced source that I pulled down (files are all prefixed with FSL_)

Field Service Admin for creating Permission Sets - Screen Grab

I realize I can manually hit the buttons on the screen shown above, but I'm looking for the SFDX command-line way to do the same

4
  • 1
    As you suspected, these belong to the FSL package so cannot be deployed in this way. A simple solution to that is to basically turn them into your own perm sets by de-namespacing them (but not the object and field perm definitions within them).
    – Phil W
    Commented Mar 23, 2022 at 7:57
  • @PhilW - so, in your experience, there's no RESTFul Apex API call I can make from script .. no magic incantation.. to simulate a human pressing those buttons?
    – bkwdesign
    Commented Mar 23, 2022 at 14:07
  • 1
    This is a custom lightning page with specific logic behind those buttons. It is possible this logic is exposed in a REST API, though I doubt it. (While I used to work for ClickSoftware, the original developers of FSL, that was over 5 years ago and things clearly change.) If you have packaged permission sets that are equivalent, that may be good enough (though you'll have to maintain them, updating them over time as FSL changes what it generates in these perm sets).
    – Phil W
    Commented Mar 23, 2022 at 14:18
  • @PhilW - see my answer, below. It looks like i can push the permission set metadata after all - as long as I'm not referencing a FSL application tab within said metadata
    – bkwdesign
    Commented Apr 11, 2022 at 2:56

1 Answer 1

0

Ok, looks like I stand corrected

I'm not sure if I was doing something wrong, or that a minor improvement was made in CLI version sfdx-cli/7.144.2 - but I was able to push the permission-set metadata from the sandbox over to my scratch org just now...

DEPLOY PROGRESS | ████████████████████████████████████████ | 19/19 Components
Updating source tracking... done

=== Pushed Source
STATE    FULL NAME                               TYPE           PROJECT PATH
───────  ──────────────────────────────────────  ─────────────  ───────────────────────────────────────────────────────────────────────────────────────────────────
Created  Create_Report_Dashboard_Folders         PermissionSet  field-svc\main\default\permissionsets\Create_Report_Dashboard_Folders.permissionset-meta.xml
Created  Edit_Task                               PermissionSet  field-svc\main\default\permissionsets\Edit_Task.permissionset-meta.xml
Created  FSL_Admin_License                       PermissionSet  field-svc\main\default\permissionsets\FSL_Admin_License.permissionset-meta.xml
Created  FSL_Admin_Permissions                   PermissionSet  field-svc\main\default\permissionsets\FSL_Admin_Permissions.permissionset-meta.xml
Created  FSL_Agent_License                       PermissionSet  field-svc\main\default\permissionsets\FSL_Agent_License.permissionset-meta.xml
Created  FSL_Agent_Permissions                   PermissionSet  field-svc\main\default\permissionsets\FSL_Agent_Permissions.permissionset-meta.xml
Created  FSL_Bundle_License                      PermissionSet  field-svc\main\default\permissionsets\FSL_Bundle_License.permissionset-meta.xml
Created  FSL_Bundle_Permissions                  PermissionSet  field-svc\main\default\permissionsets\FSL_Bundle_Permissions.permissionset-meta.xml
Created  FSL_Community_Dispatcher_License        PermissionSet  field-svc\main\default\permissionsets\FSL_Community_Dispatcher_License.permissionset-meta.xml
Created  FSL_Community_Dispatcher_Permissions    PermissionSet  field-svc\main\default\permissionsets\FSL_Community_Dispatcher_Permissions.permissionset-meta.xml
Created  FSL_Community_Self_Service_Permissions  PermissionSet  field-svc\main\default\permissionsets\FSL_Community_Self_Service_Permissions.permissionset-meta.xml
Created  FSL_Dispatcher_License                  PermissionSet  field-svc\main\default\permissionsets\FSL_Dispatcher_License.permissionset-meta.xml
Created  FSL_Dispatcher_Permissions              PermissionSet  field-svc\main\default\permissionsets\FSL_Dispatcher_Permissions.permissionset-meta.xml
Created  FSL_Mobile_License                      PermissionSet  field-svc\main\default\permissionsets\FSL_Mobile_License.permissionset-meta.xml
Created  FSL_Resource_License                    PermissionSet  field-svc\main\default\permissionsets\FSL_Resource_License.permissionset-meta.xml
Created  FSL_Resource_Permissions                PermissionSet  field-svc\main\default\permissionsets\FSL_Resource_Permissions.permissionset-meta.xml
Created  Field_Service_Crew_Management           PermissionSet  field-svc\main\default\permissionsets\Field_Service_Crew_Management.permissionset-meta.xml

I did have to do a minor touch-up to the FSL_Admin_Permissions.permissionset-meta.xml, it was referencing a tab that I didn't have in my metadata

FSL_Admin_Permissions.permissionset-meta.xml (element I removed)

    <tabSettings>
        <tab>FSL__Master_Settings</tab>
        <visibility>Visible</visibility>
    </tabSettings>

While I know how to actually obtain an instance of the FSL__Master_Settings custom tab metadata file, my scratch org complains if I push the tab over.. it thinks that I'm trying to create something in the FSL namespace... but if I remove this element, everything works as shown above

You must log in to answer this question.

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