Community
Showing results for 
Search instead for 
Do you mean 
Reply

CustomSubEntitiesSample external control

New Member
Posts: 4
Country: United States

CustomSubEntitiesSample external control

Hi,

 

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.

 

Thanks,

JHaliburton

Employee
Posts: 1,163
Country: USA

Re: CustomSubEntitiesSample external control

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.  

Matthew Wood
Act! SDK Support
Community Moderator
New Member
Posts: 4
Country: United States

Re: CustomSubEntitiesSample external control

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.

 

New Member
Posts: 4
Country: United States

Re: CustomSubEntitiesSample external control

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)
        {

Employee
Posts: 1,163
Country: USA

Re: CustomSubEntitiesSample external control

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. 

Matthew Wood
Act! SDK Support
Community Moderator
New Member
Posts: 4
Country: United States

Re: CustomSubEntitiesSample external control

Thanks for your help.

 

 

I created a constructor overload for the PolicyForm:

 public PolicyForm()
        {
            
            InitializeComponent();
           
         }

 

 

Then from my application:

 Dim sAct As New Act.DevNet.CustomSubEntitiesSample.PolicyFormNew
 sAct.Show()

 

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.

 

Copper Elite Contributor
Posts: 95
Country: USA

Re: CustomSubEntitiesSample external control

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

tEntry.SetContacts(CList);

 

// set some field values

tEntry.Fields["Real field name", true] = "some string";

// or

 tEntry.Fields["not the real field name", false] = "some string";

.... do it a few more times

 

tEntry.Update();

 

// job done.

Nick Bohne
Effective Solutions, Inc.