The M-Files Community will be updated on Tuesday, April 2, 2024 at 10:00 AM EST / 2:00 PM GMT and the update is expected to last for several hours. The site will be unavailable during this time.

This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Start an Object Creator copy rule from a workflow

I have a working Object Creator copy rule that is activated manually from the task menu on the left-hand side.
whats the best way to activate this automatically?
The user creates a new object and then once done, will press the button to create the new object and then I link them within the rule.

I have a workflow for the new object. can I make a state in the workflow that will activate the object creator copy rule?

idea is that once the new Object is made, a multifile document is made and linked to the object for storing its documents.

Cheers

Pete

Parents
  • I haven't tested this myself but I have seen people calling Object Creator via a workflow script. The call would be something like this where you provide the source object and the Object Creator rule to the vault extension method:

    Dim strProjIds: strProjIds = "(" & iObjectType & "-" & iObjectID & "-" & iObjectVersion & ")"
    Call Vault.ExtensionMethodOperations.ExecuteVaultExtensionMethod("MFiles.ComplianceKit.MFEventHandlerVaultExtensionMethod","['ObjectCreator.Action','" & strProjIds & "','" & strRuleName & "']")

    Note: I'm not certain if this is an officially supported way to use Object Creator since it has been designed as a UI extension to help users with context-sensitive object creation and the vault extension method above is undocumented as far as I know. If it works then fine but keep in mind that there are no guarantees that it will continue working with future Compliance Kit releases.

  • hi
    thank you for getting back to me. i am hopeless at scripting, have I got this correct?

    iObjectType = Source Object = which is 'Application'
    iObjectID = Source object ID = which is '105'
    iObjectVersion = don't understand
    ObjectCreator.Action = copy rule which is 'CopyRules'
    strRuleName = which is 'ApplicationDocumentCopy'

    This is my Object Creator config

    "Enabled": true,
    "PanelGroups": [
    {
    "Key": "PanelGroup1",
    "Title": "Application Documents"
    }
    ],
    "CopyRules": [
    {
    "Key": "ApplicationDocumentCopy",
    "RuleType": "AllowAndShow",
    "Command": {
    "GroupKey": "PanelGroup1",
    "Title": "Create Application Multi-File",
    "IconType": "DefaultIcon",
    "DefaultIcon": "DefaultIcon_MakeCopy"
    },
    "Source": {
    "ObjTypes": [
    "OT.Application"
    ],
    "Classes": [
    "CL.OT.Application"
    ]
    },
    "Create": {
    "ObjType": "{53F0C8FD-0BF0-47C4-8FA6-4C2D0DADB650}",
    "Class": "CL.ApplicationDocuments",
    "SingleFile": false,
    "DefaultPropertyActionIsCopy": true,
    "AddProperties": [],
    "SetProperties": [
    {
    "Property": "{CE29A29B-E454-4741-A1B1-3B3D7A4CCC4B}",
    "Value": {
    "Mode": "Dynamic",
    "DynamicValue": "%.%"
    }
    }
    ]
    },
    "RelatedObjectRules": [],
    "CreatePriority": 1,
    "Interactive": true
    }
    ]
    }

    Really appreciate your help

  • As far as I understand "object version" refers to the version number and "ObjectCreator.Action" you can leave as it is in the example. You probably have to get the latest version number from your source object in your script somehow,  might have some tips for this.

  • ok, in theory it is 1 then as the object creator is making a new object.
    cheers

  • This refers to the source object ie. the object from where Object Creator will copy values, not the newly-created object that OC creates.

Reply Children
No Data