0

I'm trying to deactivate all active flows via sf data cli

I saw docs said we can deactivate if via Metadata field You can activate and deactivate flows with the Metadata field. enter image description here

Below command is trying to get curret active, and then update it. but it cant access to Metadata field


flowsVersion=$(
  sf data query --query "SELECT Id, ActiveVersion.Id, ActiveVersion.MasterLabel, ActiveVersion.Status, ActiveVersionId FROM FlowDefinition WHERE ActiveVersion.Status = 'Active'" \
  --use-tooling-api --wait 10 --json  --target-org $targetOrgAlias | jq -r '.result.records'
)

# Deactive all active flows, to prepare for uninstalling package
while IFS= read -r flow; do
  flowId=$(echo $flow | jq -r '.Id')
  flowName=$(echo $flow | jq -r '.ActiveVersion.MasterLabel')

  echo "======= Deactive flow $flowName with id $flowId ======  "

  sf data update record --json --use-tooling-api --target-org $targetOrgAlias --sobject FlowDefinition --record-id $flowId --values "mns:FlowDefinition.activeVersionNumber=0"

done < <(echo $flowsVersion | jq -r -c '.[]')

The error said

  "message": "No such column 'mns:FlowDefinition.activeVersionNumber' on sobject of type FlowDefinition",
1
  • ah I found appropriate syntax sf data update record --json --use-tooling-api --target-org $targetOrgAlias --sobject FlowDefinition --record-id $flowId --values "Metadata='{\"activeVersionNumber\":0}'" works as well
    – vctqs1
    Nov 15, 2023 at 18:13

1 Answer 1

2

ah I found appropriate syntax

sf data update record --json --use-tooling-api --target-org $targetOrgAlias --sobject FlowDefinition --record-id $flowId --values "Metadata='{\"activeVersionNumber\":0}'"

works as well

You must log in to answer this question.

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