11-02-2010 03:47 PM
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.
11-03-2010 07:41 AM
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;
11-15-2010 06:07 PM
11-16-2010 06:22 AM
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;