I'm using MetadataAPI to activate a Process Builder flow from Apex code, even I'm specifying the testLevel option, it still giving me this error:
Web service callout failed: WebService returned a SOAP Fault: INVALID_OPERATION: testLevel of NoTestRun cannot be used in production organizations faultcode=sf:INVALID_OPERATION
MetadataService.MetadataPort service = createService(); MetadataService.DeployOptions deployOptions = new MetadataService.DeployOptions(); deployOptions.allowMissingFiles = false; deployOptions.autoUpdatePackage = false; deployOptions.checkOnly = false; deployOptions.ignoreWarnings = false; deployOptions.performRetrieve = false; deployOptions.purgeOnDelete = false; deployOptions.rollbackOnError = true; deployOptions.testLevel = 'RunAllTestsInOrg'; deployOptions.singlePackage = true;
I would like if there something I'm not specifying or if there's a configuration I should use in order to make it work.
Note: It is working good in developer and non production environments.