I'm following this document to trigger refresh sandbox, also want to set Apex class in post copy

sf data update record --json --use-tooling-api --target-org $targetOrgAlias \
        --sobject SandboxInfo --record-id $sandboxInfoId  \
        --values "TemplateId=$templateId" \
        --values "AutoActivate=true" \
        --values "ApexClassId=$apexClassId" \
        --values "LicenseType=$licenseType"

But instead refresh and set apex class. But after refresh success, the Apex class is empty and nothing run afterward. Has anyone else encountered this specific problem? I'd appreciate any advice or insights on how to resolve this issue effectively

--- Update --- Also the apexClassId was getting from source org not from sandbox metadata? Should I retrieve from sandbox?

    sf data query --query "SELECT Id, Name FROM ApexClass WHERE Name='PackageInstallerSandboxPostCopy' LIMIT 1" \
    --use-tooling-api --wait 10 --json  --target-org $targetOrgAlias 2>/dev/null | jq -r '.result.records[0].Id // ""'


You must log in to answer this question.

Browse other questions tagged .