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

how to create an object type (in VB) on workflow state transition

Hello,

I am trying to create an object type when the workflow is in the final stage. The object type is connected over an external source through API.
The idea is to notify some external system through object type creation.

on the workflow transition, I have added the following code in the workflow state PreConditions:


option explicit


Dim publishedReportObjectTypeAdmin
Set publishedReportObjectTypeAdmin = CreateObject("MFilesAPI.ObjTypeAdmin")


Dim publishedReportObjectType
Set publishedReportObjectType = CreateObject("MFilesAPI.ObjType")
publishedReportObjectType.ID = 129
publishedReportObjectType.AllowAdding = true

publishedReportObjectTypeAdmin.ObjectType = publishedReportObjectType
publishedReportObjectTypeAdmin.ConnectionString = "M-Files Extension={5417ed7c-d1a0-43bf-bbae-e84b398e6059};type=publishedreport"

'currently the values are hardcoded here just to test if it is working
publishedReportObjectTypeAdmin.InsertIntoStatement="INSERT INTO  ( DocumentName, DocumentDate, DocumentCreator ) VALUES( 'testDoc', '12-04-2020', 'workflow' )"

Vault.ObjectTypeOperations.AddObjectTypeAdmin(publishedReportObjectTypeAdmin)


I get this error :
Incompatible isolation levels: "65536 -> 1048576".

How can I achieve the creation of object type on state transition ?


Parents
  • Hi Craig,

    Thanks for the response.

    What I want to achieve is :

    There's a SYSTEM A which is connected to M-files through ODBC over REST API.
    We have an object Type called : 'Published Reports for SYSTEM A' which basically contains the following properties :

    • Document Name

    • Published Date

    • Published By



    I am able to create/read/update the object types manually over the rest API.


    Now, there's a SYSTEM B which is also connected to M-files through ODBC over REST API.
    We have an object Type called : 'Published Reports for SYSTEM B' which basically contains the following properties :

    • Source Department

    • Target Department

    • Document Name

    • Published Date

    • Published By

    • Signed By



    Manually I am able to create/update/get object types of this over the REST API

    The Usecase :
    In my workflow when the document is published, I want SYSTEM A and SYSTEM B to be notified through object type creation. So I try to create the object types in the PreConditions.

    If that's not the right place to create the object types, can you please suggest me how can I do so programatically ?

    Regards,
    Shoeb
Reply
  • Hi Craig,

    Thanks for the response.

    What I want to achieve is :

    There's a SYSTEM A which is connected to M-files through ODBC over REST API.
    We have an object Type called : 'Published Reports for SYSTEM A' which basically contains the following properties :

    • Document Name

    • Published Date

    • Published By



    I am able to create/read/update the object types manually over the rest API.


    Now, there's a SYSTEM B which is also connected to M-files through ODBC over REST API.
    We have an object Type called : 'Published Reports for SYSTEM B' which basically contains the following properties :

    • Source Department

    • Target Department

    • Document Name

    • Published Date

    • Published By

    • Signed By



    Manually I am able to create/update/get object types of this over the REST API

    The Usecase :
    In my workflow when the document is published, I want SYSTEM A and SYSTEM B to be notified through object type creation. So I try to create the object types in the PreConditions.

    If that's not the right place to create the object types, can you please suggest me how can I do so programatically ?

    Regards,
    Shoeb
Children
No Data