cancel
Showing results for 
Search instead for 
Did you mean: 

WorkView Unity API 9.2

Patricia_Baksh
Champ in-the-making
Champ in-the-making

We have Workview with Onbase 9.2. I am writing a C# Unity app which in part should create a WV object. When CreateObject() is executed, an error is produced -

"Error HRESULT E_FAIL has been returned from a call to a COM component."  Stack trace below. Our advance script are written in VB script. It seems to me that it's executing the advance script on CreateObject(). Line 67 points to Filter Query's SetFilterByName. Can you help me to resolve this issue? How can I create the WV object in my external app without executing the VB script advance script? Thanks.

 at CRMXObject::executeEventScript(classID=1040), Error Code: 0x80004005, Message: Script error -2147467259 at (67,1): Running: -Running: , File: .\RMXObject.cpp, Line: 7613
 at CRMXObject::InitNew, Error Code: 0x80004005, Message: Failed to execute initialization event script., File: .\RMXObject.cpp, Line: 345
 at CRelationManagementServices::CreateObject, Error Code: 0x80004005, Message: Failed to initialize new object., File: .\RelationManagementServices.cpp, Line: 1416

   at DLL_RMMGMTSVCLib.IRMXRelationManagementServices.CreateObject(String bstrData)
   at Hyland.Core.Workview.MixedModeUtility.CreateObject(Session session, Class wvClass, AttributeValueList attributeValues, Int64 parentObjectId, String& errorMessage)
   at Hyland.Core.Workview.Object.CreateObject(Session session, Class wvClass)
   at Hyland.Core.Workview.Services.Unity.WVClass.CreateObject()

4 REPLIES 4

Patrick_Ramser
Star Contributor
Star Contributor

Hey Pat,

Sorry for such a late response. Figured I would see if anybody else on Community would answer first since WorkView isn't in my (particular) wheelhouse.

For the issue at hand, you're saying that you're writing a C# script using CreateObject() for it's intended purpose in an external application. When you leverage that method, a previously configured VB script is firing which is tied to object creation and causing the aforementioned error.

I don't believe we have any way through the Unity API outside of straight up disabling the script for allowing it to be "skipped" for certain executions or even that one in particular. So, we'll have to see what's causing this exception to get thrown.

Does the VB script still work fine when having execute it outside of a Unity Script? I know it sounds ridiculous, but you never know.

Also, in SetFilterByName does that particularly pull in any information that the Unity API might not have context for when the VB script executes?

Patricia_Baksh
Champ in-the-making
Champ in-the-making

Hi Patrick,

Thanks for taking the time to respond. My responses in (bold)....

 

Hey Pat,

Sorry for such a late response. Figured I would see if anybody else on Community would answer first since WorkView isn't in my (particular) wheelhouse.

For the issue at hand, you're saying that you're writing a C# script using CreateObject() for it's intended purpose in an external application. When you leverage that method, a previously configured VB script is firing which is tied to object creation and causing the aforementioned error. (That is correct.)

I don't believe we have any way through the Unity API outside of straight up disabling the script for allowing it to be "skipped" for certain executi Thons or even that one in particular. So, we'll have to see what's causing this exception to get thrown.

Does the VB script still work fine when having execute it outside of a Unity Script? (Yes it works fine. When we create the object in Workview, the VB script is executed and the object is created successfully) I know it sounds ridiculous, but you never know.

Also, in SetFilterByName does that particularly pull in any information that the Unity API might not have context for when the VB script executes?

( Let me first say that when the VB script fires off, the WV object's attributes have not been populated yet by the Unity code. The SetFilterByName is preparing to execute a filter query. The next step would have been to set up constraints for the query. The fact that the attributes have not been created yet should not be material for the statement in error.  I wonder though if the issue is that we're mixing DMCoreX code with Unity Code.)

Nick_Knight
Star Collaborator
Star Collaborator

Hi Pat,

Patrick brought this to the attention of the WorkView team, so I took a look at it.

It took a little time, but after looking at some C++ code and searching some older memory banks, I believe I see the issue.  In fact, I'm almost certain I have it.  Even better news?  If it is what I think it is, we can fix this with relative ease.

Some background:  In the really really old days, you could only set a filter by ID.  This was silly and didn't make scripts very portable as you moved applications around to different databases (via export/import).  So, we invented the much more friendly call that sets the filter by name.  This is the call that your VB Script is using.  And the C++ internal API uses this all of the time.

There is one problem with this.  Filter names are NOT unique throughout the entire WorkView system; they are unique ONLY within an application.  The SetFilterByName call works IF and ONLY IF a "runtime application" is set.  All C++ based clients set the runtime application up front.  For example, the web client sets this the minute you select the application from the menu.  This insures that when called SetFilterByName you are getting the filter you expect, and not one named the same from another application.

If this runtime application value is not set, and you call SetFilterByName a null pointer results and an exception is thrown.  Which I'm sure is the issue you are experiencing.

You should already have the RMXRelationshipManager object in your script .... it is set as an automatic variable when this script hook is called.  All you have to do BEFORE calling SetFilterByName is to call relMgmt.SetRuntimeApplication(9999), where 9999 is the ID of your application.  You are free, of course, to use the APIs to look the application up by name to acquire the ID programmatically, but you may simply want to hardcode it at first to make sure it solves your issue.

Let me know if this works for you.  Also let me know if you need more information on how to script this; I can do better to provide a code snippet, but I'll let you try it first.

Patricia_Baksh
Champ in-the-making
Champ in-the-making

Thanks Nick, that worked! Actually, had to use the rmServices class to set the application id.