Skip to content

vault mdl

Execute an MDL statement.

vault mdl <STATEMENT>
OptionTypeRequiredDescription
<STATEMENT>stringRequiredThe MDL statement or script to execute, enclosed in quotes

This command also accepts the global options.

Execute from a file (macOS / Linux)

Section link for Execute from a file (macOS / Linux)
vault mdl "$(cat components/Picklist/color.mdl)"

Execute from a file (Windows PowerShell)

Section link for Execute from a file (Windows PowerShell)
vault mdl (Get-Content -Raw components/Picklist/color.mdl)

Note: vault mdl does not read from stdin. Passing the file content as a string argument works on all platforms.

Component files in a vault config pull workspace contain @ references to subcomponent and sidecar files, so vault mdl cannot execute them directly. Use vault config push to deploy workspace components.

vault mdl "CREATE Picklist color__c (label('Color') active(true));"

Recreate a picklist with new values

Section link for Recreate a picklist with new values
vault mdl "RECREATE Picklist color__c (label('Color') active(true) ENTRY red__c (label('Red') active(true)) ENTRY blue__c (label('Blue') active(true)));"
vault mdl "DROP Picklist old_status__c;"

Single statement, no warnings:

Executing MDL...
SUCCESS MDL executed.

Multi-statement script:

Executing MDL...
[1] SUCCESS  CREATE Picklist.color__c
[2] SUCCESS  DROP Picklist.old__c
SUCCESS MDL executed.

Statements with warnings produce MDL executed with warnings. instead of SUCCESS MDL executed.

If a statement fails, the CLI reports every statement's outcome, not only the failing one. MDL scripts are not transactional. Earlier successful statements are not rolled back on failure.

For MDL syntax, see the MDL reference.