Instantiating a Business Object within a server-side script
Hi,
I have searched the forums to find a method to instantiate a business object in a server side script, with no success.
I have a business object which parses a parameter and returns a single row of user information. (Its an LDAP BO)
I would like to use this business object within a server side script, however I have not been able to find a method to do this.
Has anyone else achieved this?
ie of what I am trying to achieve
BO1 myBO = new BO1(paramters parsed);
string myName = myBO.name;
Thanks,
Ryan
Comments
-
Agreed, I have posted about this before but it drew no responses - would be interesting to get a response from OpenText......
0 -
How about passing in a Business Object to your server side script instead of instatiating?
So you would define your business object, set the parameter(s) you want for the business object, then pass it in as an object.
Here is an example method that you can then use in the visual scripting by dragging it in, and then just assign the parameter and it is useable in the method.
[Promote(PromotionTargets.VisualToolbox)]
[Category("UserCategory")]
public static bool SampleActivity(Metastorm.Runtime.Models.ConnectionTestProj.BusinessObject1 bo1)
{
if(string.IsNullOrEmpty(bo1.eUserName)){
return false;
}
return true;
}Does that work for your requirement?
Cheers
Phil
0 -
I can initiate a parameterless BO in code, and it works fine (ignore the erroneous Intellinonsense that it shows you):
Metastorm.Runtime.Models.Project1.BusinessObject1 bo = new Metastorm.Runtime.Models.Project1.BusinessObject1();
What I cannot do is add and set the parameters and make it refresh. I have tried:
bo.Parameters[0] = new Metastorm.Runtime.Core.Mbo.Parameter("@pMapName", "BL_Invoice");
bo.Refresh();but that does not work. It may be that there is another way to refresh it that does work.
0 -
Hey Ryan,
Well if you setup the Business Object with the eFolderId parameter, and at the process level you define the "eFolderId" parameter to ProcessContext.FolderId, then when you pass this business object to the function from within your visual script, the assignment of the parameter is already set so you don't need to do anything.
I haven't needed to instantiate a business object from within a server side script, but from what Jerome is saying, it sounds like it has to be a business object without any parameters as you can't call the refresh() method to update the dataset returned.
Hope that helps.
Phil
0 -
Hi Phil,
Thanks again for your help.
If my function is using the ExpressionBuilder and I am parsing the BO; what parameter would I use to replace ****?
Currently I have myProcessData1 as the BO used in the process; however this is the incorrect type to parse through.
eg.
From the expression builder I would call:
ServerScript.myFunction(****);
Script:
[Promote(PromotionTargets.ExpressionBuilder)]
[Category(
"My functions")]
[Alias(
"Test function")]
public static string myFunction(Metastorm.Runtime.Models.TenantProject.TEProcess myProcess) {
....
}
Cheers,
Ryan
0 -
Hey Ryan,
I've put together this quick solution to demo how either the process data object or a defined business object can be passed to, and used in a server side script.
This is set as a visual scripting activities, but the expression builder method is very similar.
The solution is coded up in version 9.1.2.3.
http://www.evolosoft.com/wp-content/uploads/2012/12/BusinessObjectToScript.zip
Any questions or problems getting it deployed just let me know.
Cheers
Phil
0
Categories
- All Categories
- 123 Developer Announcements
- 54 Articles
- 152 General Questions
- 148 Thrust Services
- 57 Developer Hackathon
- 37 Thrust Studio
- 20.6K Analytics
- 4.2K AppWorks
- 9K Extended ECM
- 918 Core Messaging
- 84 Digital Asset Management
- 9.4K Documentum
- 32 eDOCS
- 190 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 10 XM Fax
- Follow Categories