Need help with scripted business objects

The documentation with 9.1 has not helped me too much. Does anyone have a simple example of how to create a scripted business object?

 

thanks

Tagged:

Comments

  • Have you seen the sample process located in?

    C:\Program Files (x86)\Metastorm\BPM\Sample Processes\sample 3

    This may help if you haven't seen it already.

  • Robin,

     

    Sorry to bump an old thread but when deploying this I can't fathom out how it works (or actually if it does!)  Is there any documentation for this?  I've just deployed 9.1 SR1 and the only pdf's in the samplehelp directory relate to examples 1 and 2?

     

    Thanks,

     

    Paul.

  • Paul,

     

    Have you had a look at the latest Designer guide.  9.1.1 (the latest) goes into some detail.

    26.12 of the 9.1.1 Designer guide covers scripted business objects (pages 148 to 171).  It goes into some detail.

     

     

  • I can't believe I've been on for a whole day with somthing that would take an hour in V7 and I'm still no further forward.

     

    I followed the guide to the letter and I've had code generation failures, and now after deleting all bo's and server side script I now have a different error for exactly the same pasted back in code :(  ...."boClassName does not contain a constructor that takes '2' arguments"

     

    No where in the documentation does it mention additional arguments other then the connection details?  Hopefully I've just missed something simple and I'm getting closer to light at the end of the tunnel!

     

    Sorry Rob - really frustrated!

  • The issue is probably that your BO definition is out of synch with your script, if you've been modifying the parameters.  This is a known issue with the way scripted BO's currently work...it is being addressed from what I'm told.

     

    Make sure you refresh your BO definition by clicking the Refresh button next to the script name dropdown, and if that fails, it is because your parameters are out of synch.  You may have to manually add the parameters to the BO so that there are the same number and names as your BO script.

     

    Not sure if that is well documented.

  • Hey Ari,

     

    Thanks for the suggestions but tried going through the steps and still not getting anywhere.  Could I be missing something basic?

     

    The error being shown is:

    Error 16/12/2011 20:16:53 "'Metastorm.Runtime.Models.pSearch.pSearchQuery' does not contain a constructor that takes '2' arguments
    'Metastorm.Runtime.Models.pSearch.pSearchQuery' does not contain a constructor that takes '3' arguments
    'Metastorm.Runtime.Models.pSearch.pSearchQuery' does not contain a constructor that takes '3' arguments
    'Metastorm.Runtime.Models.pSearch.pSearchQuery' does not contain a constructor that takes '4' arguments
    "

     

    My bo has two parameters that are correctly shown in the business objects view - although the designer does report an error if I try to set a default parameter value there?  There is no way to set these in the constructor - should there be?

     

    Cheers,

     

    Paul.

  • Hmmm, I've  just re-opened the solution to take another look and now the error is being reported as:

     

    Error 16/12/2011 23:22:37 "The call is ambiguous between the following methods or properties: 'Metastorm.Runtime.Models.plSearch.pSearchQuery.pSearchQuery(Metastorm.Runtime.Contracts.Mbo.MboConnectionInfo)' and 'Metastorm.Runtime.Models.plSearch.pSearchQuery.pSearchQuery(Metastorm.Runtime.Core.Mbo.MboConnection)'
    "

     

    Why it's changed I've no idea but does this shed anylight on what the issue may be?

     

  • One step forwards, one step backwards...

     

    I removed one of the constructors (the one that declared using MboConnectionInfo and the process finally deployed which was good news but I'm not sure what the affect of removing this constructor is - can anyone enlighten me?

     

    The next issue, whilst there is only a text box and a command button on the form it fails to open with the message "Failed to execute deployed method 'DataValue', using entity 'Grid1'. unknown paramater name: @eUserName

     

    Can anyone advise how to get past this?  I'm loathed to start rebuilding this process a 3rd time but I deleted that object "Grid1" from the form a few publishes ago but a reference still seems to be hanging around?

     

    Cheers,

     

    Paul.

     

     

  • Paul

    Do you found problem?
    I want to start using this feature but my developers has also some strange experience with this.

  • Hi,

     

    My scripted business object works.. however soon as I close my solution and reopen it I get the error:

     

     Error 26/Jul/2013 01:43:13 pm   "The call is ambiguous between the following methods or properties: 'Metastorm.Runtime.Models.MyProject.ScriptedBO.ScriptedBO(Metastorm.Runtime.Core.Mbo.MboConnection)' and 'Metastorm.Runtime.Models.MyProject.ScriptedBO.ScriptedBO(Metastorm.Runtime.Contracts.Mbo.MboConnectionInfo)'
    "  

     

    The only way for me to edit my solution is to remove the BO and readd it... this then involves fixing all my grids which clear out which use this BO.

     

    I am uncertain what constructor I can remove without causing other issues?

     

    Has anyone seen this and found a solution?

     

    Thanks,

    Ryan

  • Is there a solution to the issue reported by Ryan? I am working with version 9.4 and have the same issue with getting the error about the ambiguous method or property exactly as was described in the previous post.

  • I've held discussions with "top experts" within OpenText. Here is my question and their (current) answer:

    Question:
    The Metastorm Designer's User Guide (DUG) has not, at least to that of which I can discern, an example of using a Business Object (BizObj) in a Server Script that is not already attached to a form.
    I'm seeking to make a call upon a BizOjbj during a Timed Event, that BizObj only used within Timed Events, of which calls a function in a Server Script.
    The BizObj is but a query returning a table of a single or more rows.
    Got any example(s) ya can toss my way? Along with examples, a reference to where in the DUG this use is identified would also be appreciated.

    (Current) Answer:
    I also received this from one of our experts. I somewhat understand what he's saying, but you have much more programming experience than I do, so will likely understand it better. Here's his reply to my inquiry about using a Scripted Business Object (which is the direction I thought we might need to go):


    I think the issue is that you can't manually instantiate a Metastorm Business Object - Metastorm has to do that (behind the scenes). Metastorm does this either on a Form or a Process (the only places you can add BOs). So within scripting code on a Form or within a Process (actions/stages), you can have access to an instance of any BO you've added to that form/process. However, you won't have access to an instantiated BO from within a Server Script. The only way to do that is to pass an already instantiated BO into your Server Script from a Form/Process (as in the example you provided).

    Even Scripted Business Objects (which provide loads of extensibility and will even allow you to control exactly when they get executed if you code them right) won't help you much in this case. There is a way to achieve this with Scripted BOs - you can instantiate them from a Server Script - but Scripted Business objects involve a lot of code and this would defeat the object here, which seems to be reusing BOs and avoiding extra code.

    The solution is to execute a normal SelectSQL query, without using a BO, if they want to use a Server Script (eg if they need it to be re-usable / available across multiple processes etc). If they are using stored procedures for their queries, then they won't even have to duplicate the SQL - just call the same stored proc as they call in their BO. It's simply that BOs don't cater for every eventuality, and in most projects you can't get away with just having all of your SQL neatly placed in BOs only.