Community
Showing results for 
Search instead for 
Do you mean 
Reply

Calculated Fields in ACT! by Sage Premium for Web 2010 Version 12

Tuned Listener
Posts: 7
Country: New_Zealand

Calculated Fields in ACT! by Sage Premium for Web 2010 Version 12

I have custom fields in my contact and one of the field is the difference of two fields.

 

Let say field A, field B and field C.

 

When a user enters field A and field B, i want to create a program that will trigger the update to field C, where field C is the difference of field A and field B.

 

What type of program do i need to create in Act Premium for Web? Is it a plug-in?

 

Sample code is much appreciated.

 

Thanks.

Employee
Posts: 1,163
Country: USA

Re: Calculated Fields in ACT! by Sage Premium for Web 2010 Version 12

There's certainly more than one way to accomplish this, if it were me i'd probably develop it as a plug-in so that i could hook into the FieldChanged event.

 

Here's a quick sample of capturing the value of two fields and subtracting them in c#:

 

DBFieldDescriptor field1 = ActApp.ActFramework.Contacts.GetFieldDescriptor("YourField1");
DBFieldDescriptor field2 = ActApp.ActFramework.Contacts.GetFieldDescriptor("YourField2");
Contact c = ActApp.ApplicationState.CurrentContact;
int number1 = System.Convert.ToInt32(field1.GetValue(c));
int number2 = System.Convert.ToInt32(field2.GetValue(c));
int value = number1 - number2;

Matthew Wood
Act! SDK Support
Community Moderator
Tuned Listener
Posts: 7
Country: New_Zealand

Re: Calculated Fields in ACT! by Sage Premium for Web 2010 Version 12

How can i hook into the FieldChanged event in act premium for web 2010?
Employee
Posts: 1,163
Country: USA

Re: Calculated Fields in ACT! by Sage Premium for Web 2010 Version 12

This code is untested, but compiled fine

 

this.afw = this.ACTSessionManager.Framework;
FieldDescriptorCollection fields = afw.Fields.GetFields(RecordType.Contact);
FieldDescriptor f = fields[0];
f.Changed +=new EventHandler(f_Changed);
void f_Changed(object sender, EventArgs e)
{
//Do Stuff
}

 

 

this.afw = this.ACTSessionManager.Framework;
Matthew Wood
Act! SDK Support
Community Moderator