Skip to content

This asynchronous endpoint executes the given MDL script on a Vault.

While you can execute any MDL script with this endpoint, it is required if you’re operating on 10,000+ raw object records and executing one of the following operations:

  • Enabling lifecycles
  • Enabling or disabling object types
  • Adding or removing a field
  • Updating the max length of any variable-length field, such as Text, Long Text, or Rich Text
  • Adding or removing an Index
  • Changing the fields that compose an Index or otherwise would cause reindexing to occur

After initiating this request, your raw object’s configuration_state becomes IN_DEPLOYMENT. While a raw object is IN_DEPLOYMENT, you cannot edit its fields, list layouts, or indexes. If your raw object deployment request has not yet begun execution, you can cancel the deployment.

This endpoint can only queue one asynchronous change at a time. If you have multiple requests, you must wait for the previous request to complete or use a VPK.

POST/api/mdl/execute_async
NameDescription
Content-Typeapplication/json or application/xml
Acceptapplication/json (default) or application/xml

The body of the request should contain the MDL script to execute. Enter the body as raw data. The body must start with one of the following values:

  • CREATE
  • RECREATE
  • RENAME
  • ALTER
  • DROP

Learn more in the MDL Commands documentation.

curl -X POST -H "Authorization: {SESSION_ID}" \ -H "Content-Type: application/json" \ --data-raw 'RECREATE Picklist color__c ( label('Color'), active(true), Picklistentry red__c( value('Red'), order(1), active(true) ), Picklistentry blue__c( value('Blue'), order(2), active(true) ), Picklistentry green__c( value('Green'), order(3), active(true) ) );' \ https://myvault.veevavault.com/api/mdl/execute_async
{ "responseStatus": "SUCCESS", "script_execution": { "code": "GEN-S-0", "message": "OK", "warnings": 0, "failures": 0, "exceptions": 0, "components_affected": 1, "execution_time": 0.622 }, "job_id": 327103, "url": "/api/v26.1/services/jobs/327103" }

On SUCCESS, the response includes the following information:

NameDescription
job_idThe Job ID value to retrieve the status and results of this request. Use this ID to query for the job status and results.
urlURL to retrieve the current job status of this request.
codeThe response code indicating whether the script has passed or failed syntax validation.
messageA descriptive message for any warnings, failures, or exceptions. If there are none, returns OK.
warningsThe number of warnings received while validating the script syntax.
failuresThe number of errors received while validating the script syntax.
exceptionsThe number of exceptions received while validating the script syntax.
components_affectedThe number of components affected by this script.
execution_timeThe length of time taken to validate this script syntax, in milliseconds.