Skip to content

vault mdl

Execute an MDL statement directly against the connected Vault.

vault mdl <STATEMENT> [--dns <DNS>]
OptionTypeRequiredDescription
<STATEMENT>stringRequiredThe MDL statement to execute, enclosed in quotes
--dns <DNS>stringOptionalVault DNS to run against (default: the active vault)

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.

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.