Sen document ID from workflow to vault extension method

Hello

I have created new vault extension method:

[VaultExtensionMethod("MyVaultExtensionMethod", RequiredVaultAccess = MFVaultAccess.MFVaultAccessNone)]
private string MyVaultExtensionMethod(EventHandlerEnvironment env)
{

string docName = env.Input;

}

And I am calling that method from WF with VBScript:

Dim szDocName
szDocName = PropertyValues.SearchForProperty(0).TypedValue.DisplayValue


Dim strOutput
strOutput = Vault.ExtensionMethodOperations.ExecuteVaultExtensionMethod("MyVaultExtensionMethod", szDocName)

And that works great, I can read document name.

How do I pass Document ID to that method (instead document name) from VBScript? 

How can I send both (ID and name)?

  • The extension method can only take a single string.  If you want to send multiple values then you'll need to consider formatting those values into a single string, or to use something like JSON or XML to represent the data.

    Within your VBScript:

    strOutput = Vault.ExtensionMethodOperations.ExecuteVaultExtensionMethod("MyVaultExtensionMethod", ObjVer.ID & "- " & szDocName)

    Within your VEM:

    [VaultExtensionMethod("MyVaultExtensionMethod", RequiredVaultAccess = MFVaultAccess.MFVaultAccessNone)]
    private string MyVaultExtensionMethod(EventHandlerEnvironment env)
    {
        var id = Int32.Parse(env.Input.Substring(0, env.Input.IndexOf("-"));
        var docName = env.Input.Substring(env.Input.IndexOf("-") + 1);
    }

    Regards,

    Craig.