Community
Showing results for 
Search instead for 
Do you mean 
Reply

Getting Act Relationships for contact

Accepted Solution Solved
Copper Super Contributor
Posts: 28
Country: Canada
Accepted Solution

Getting Act Relationships for contact

I have tried to find examples of getting contact relationships, but am unable to find anything that helps me. Currently I'm looping through a set of contacts, and I need to grab the relationship of each conact...any guidance would be greatly appreciated...


Accepted Solutions
Solution
Accepted by topic author 2gen
‎03-09-2016 01:01 PM
Copper Super Contributor
Posts: 28
Country: Canada

Re: Getting Act Relationships for contact

I figured it out...after much searching and finally finding a short example that hinted at the appropriate implementation:

 

//relationships
ActFramework ACTFM = acact.ACAct.ACTFM;
AssociationManager associationManager = ACTFM.Associations.GetAssociationManager("Contact", "Contact");
Association[] associations = associationManager.GetAssociations(con);

foreach (Association association in associations)
{
 Contact one_con = (Contact)association.EntityOne;
 string one_con_role = (string)association.Fields[Act.Framework.Associations.StandardField.Entity1Role];
 Contact two_con = (Contact)association.EntityTwo;
 string two_con_role = (string)association.Fields[Act.Framework.Associations.StandardField.Entity2Role];

 Response.Write(one_con.FullName + " | " + one_con.ID + " | " + relationship_to + " <br> ");
 Response.Write(two_con.FullName + " | " + two_con.ID + " | " + two_con_role + " <br><br> ");
}




View solution in original post


All Replies
Copper Super Contributor
Posts: 28
Country: Canada

Re: Getting Act Relationships for contact

bump....just to see if there's anyone out there...

Solution
Accepted by topic author 2gen
‎03-09-2016 01:01 PM
Copper Super Contributor
Posts: 28
Country: Canada

Re: Getting Act Relationships for contact

I figured it out...after much searching and finally finding a short example that hinted at the appropriate implementation:

 

//relationships
ActFramework ACTFM = acact.ACAct.ACTFM;
AssociationManager associationManager = ACTFM.Associations.GetAssociationManager("Contact", "Contact");
Association[] associations = associationManager.GetAssociations(con);

foreach (Association association in associations)
{
 Contact one_con = (Contact)association.EntityOne;
 string one_con_role = (string)association.Fields[Act.Framework.Associations.StandardField.Entity1Role];
 Contact two_con = (Contact)association.EntityTwo;
 string two_con_role = (string)association.Fields[Act.Framework.Associations.StandardField.Entity2Role];

 Response.Write(one_con.FullName + " | " + one_con.ID + " | " + relationship_to + " <br> ");
 Response.Write(two_con.FullName + " | " + two_con.ID + " | " + two_con_role + " <br><br> ");
}




JM
Nickel Contributor
Posts: 581
Country: USA

Re: Getting Act Relationships for contact

Is there a way with ACT! Prem 18.1 to Recover defined Contacts Relationships after doing Save As Empty copy DB and after I did the import  Users, then Contacts, then Company-Groups-Oppt..

I had to do the save as empty copy DB so I could shrink my 1GB DB down to 50MB and I guess it had little corruption.

Just wondering if you have any thoughts for a non programmer?

JM