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
Delphine Foo-MatkinDelphine Foo-Matkin 

Error deploying Lightning Scheduler Flow to sandbox via SFDX: The field "ServiceAppointmentId" for the object "Event" doesn't exist.

We have Lightning Scheduler installed, and have created a flow that references the field ServiceAppointmentId on the Event object. This is a standard field that comes with the Lightning Scheduler package. However, when I try to deploy the flow to a sandbox that has Lightning Scheduler installed, I'm getting the error "The field "ServiceAppointmentId" for the object "Event" doesn't exist.", despite the fact that the field exists in the org and is visible and available to all profiles.

I am using the latest version of the Salesforce CLI, v48 or 7.63.0-c897e8bb1a. 
ShirishaShirisha (Salesforce Developers) 
Hi Delphine,

Greetings!

Can you please confirm,if you have assigned the Lightning Scheduler App to the System Administrator profile as mentioned in this document (https://trailhead.salesforce.com/en/content/learn/modules/lightning-scheduler/get-started-with-lightning-scheduler).

Also,can you please try with some other tool to deploy the flow by adding all the dependencies to confirm if the issue is not with the CLI.

Kindly let me know if it helps you and close your query by marking it as best answer so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
 
Delphine Foo-MatkinDelphine Foo-Matkin
Hi Shirisha,
Yes, we have assigned the Lightning Scheduler App to the System Administrator profile:
App assigned to System Admin

Deploying via change set works without problems. Does this mean it's a problem with the Salesforce CLI? Thanks for your help!

Delphine
ShirishaShirisha (Salesforce Developers) 
Hi Delphine,

Seems like the problem is with the components that you are trying to deploy through Changeset and the CLI.

I would suggest you to compare the component list in both payload to see,what is missing in the CLI payload.

Thank you!
Delphine Foo-MatkinDelphine Foo-Matkin
I discovered through experimentation that the problem was due to the <runInMode> tag missing from the flow (it was force:source:retrieved using sourceApiVersion 47.0 in the sfdx-project.json file), and then using force:source:deploy to deploy to the target sandbox. When I added the <runInMode>default</runInMode> tag back into the flow's xml file, the error went away when I deployed.