TransWikia.com

Flows metadata that Bypass User Permissions (SFDX)

Salesforce Asked by Átila Castro Alves on October 4, 2021

In Summer 20, we have a possibility of define a "Run mode" of a Visual Flow, to run avoiding user permission, as we can see on this link: Run Flows That Bypass User Permissions.

But when you create a flow, with "System Context Without Sharing-Access All Data" option on "How to run flow" field and pulled it from Scratch org to your local branch, you receive a flow metadata (xml) without any reference to this "Run mode". In related link (Tooling API New and Changed Objects
), they refer to a runInMode field and SystemModeWithoutSharing (enum) option to set you flow without user permission… but it isn’t on metadata. Look at this flow metadata example:

<?xml version="1.0" encoding="UTF-8"?>
<Flow xmlns="http://soap.sforce.com/2006/04/metadata">
    <interviewLabel>test {!$Flow.CurrentDateTime}</interviewLabel>
    <label>test</label>
    <processMetadataValues>
        <name>BuilderType</name>
        <value>
            <stringValue>LightningFlowBuilder</stringValue>
        </value>
    </processMetadataValues>
    <processMetadataValues>
        <name>OriginBuilderType</name>
        <value>
            <stringValue>LightningFlowBuilder</stringValue>
        </value>
    </processMetadataValues>
    <processType>Flow</processType>
    <screens>
        <name>test</name>
        <label>test</label>
        <locationX>430</locationX>
        <locationY>70</locationY>
        <allowBack>true</allowBack>
        <allowFinish>true</allowFinish>
        <allowPause>true</allowPause>
        <showFooter>true</showFooter>
        <showHeader>true</showHeader>
    </screens>
    <start>
        <locationX>50</locationX>
        <locationY>50</locationY>
        <connector>
            <targetReference>test</targetReference>
        </connector>
    </start>
    <status>Active</status>
</Flow>

Any ideas how to add this "RunInMode" and "SystemModeWithoutSharing" on flow metadata?

One Answer

I just tried this and it works without any issues.

Here are couple of steps I recommend you double check,

  1. Make sure you are on latest version of SFDX CLI by running sfdx update
  2. Make sure the apiVersion is specified as 49.0

In your sfdx-project.json make sure it is 49.0

    "sourceApiVersion": "49.0",

Correct answer by Mohith Shrivastava on October 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP