05-04-2010 06:03 PM
I have the customsubentitiessample working and can create/edit/delete policies according to the example provided.
What I would like to do is create my own app in c# or vb to call the appropriate code in the plugin dll to automatically create a new policy with data
provided by my app.
Any ideas on how to do this would be appreciated.
I have tried to create new instances of the classes with no luck.
05-05-2010 06:16 AM
What you've asked this point is extremely open ended. There are a lot of ways one could potentially handle this depending on what data you wanted to generate, when you wanted it generated, and then what you want to do with the data after the fact.
I may be wrong but it sounds as if you have an application already that generates some of this data, you could implement get/set methods in your application so you can retrieve the data generated by it and pass it into act.
05-05-2010 06:45 AM
Yes, my application will generate the data (eg policy number, policy type etc) to create a new policy in this example, which should then appear
in the policiesDataGridView. Basically I want to automate what the policyform does. My issue is I am stuck as to the syntax to use and how to do this from my application. I have tried to create a new instance of the policyform from my application, but I am not having any luck.
05-05-2010 06:57 AM
If I could just show a new PolicyForm by calling it from my app, then filling in the textboxes with data.
In my app (written in VB2005), I created a new:
dim PolicyFormInstance as new Act.DevNet.CustomSubEntitiesSample.PolicyForm
but it requires Actframework and BindingSource, and I am not sure what values I need to plug in here or how to determine them.
public PolicyForm(ActFramework framework, BindingSource bindingSource)
05-05-2010 07:45 AM
Depends on whether or not you already have an ActFramework object you could either pass it from the plugin to your application via a constructor overload or if you don't need the instance from the plugin you could simply instantiate it within your app.
The binding source, I believe (and do correct me if I'm wrong) that it's wanting the datasource your using to populate your gridview.
05-06-2010 04:53 AM
Thanks for your help.
I created a constructor overload for the PolicyForm:
Then from my application:
Dim sAct As New Act.DevNet.CustomSubEntitiesSample.PolicyFormNew
This brings up the PolicyForm.
I then tried to create a new policy in the OnLoad of PolicyForm:
Policy policy = this.bindingSource.AddNew() as Policy;
This works fine when I press the Add Policy button in the example, but when I .Show the PolicyForm from my application it is null.
05-10-2010 07:56 AM
This is gonna wander a bit, and the code won't just work, since it's a bunch of snippets, but should give you the general idea
(also it's from a plugin, not an external app, but just switch all the calls to use the framework, and it's all good)
// Find your custom table
Act.Framework.CustomEntities.CustomEntityDescriptor CED = actApplication.ActFramework.CustomEntities.GetCustomSubEntities(Act.Framework.RecordType.Contact);
for (int i = 0; i < CED.Length; i++)
if (CED[i].DisplayName == "omgitsmytable")
descriptor = CED[i];
Act.Framework.CustomEntities.CustomSubEntityManager<Policy> manager = actApplication.ActFramework.CustomEntities.GetSubEntityManager<Policy>(descriptor);
// New table entry
Act.Framework.CustomEntities.CustomSubEntity tEntry = manager.CreateCustomEntity();
// set the contacts
// set some field values
tEntry.Fields["Real field name", true] = "some string";
tEntry.Fields["not the real field name", false] = "some string";
.... do it a few more times
// job done.