Community
Showing results for 
Search instead for 
Do you mean 
Reply

ACT for Web - Get the current contact

New Member
Posts: 11
Country: USA

ACT for Web - Get the current contact

How do I get a Act.Framework.Contacts.Contact object for the current contact in Act 2011 for Web.

 

I know the current contact ID from (ActSessionManager) obj.CurrentContactID but I am not seeing a way to retrieve the full contact object that I need for an API call.

 

Thanks

Employee
Posts: 1,163
Country: USA

Re: ACT for Web - Get the current contact

I'm not sure there is a straightforward way to accomplish this in AFW, unlike in the windows version where you have access to the ActApplication object and the properties exposed by it such as CurrentContact etc.

Matthew Wood
Act! SDK Support
Community Moderator
Platinum Elite Contributor
Posts: 14,384
Country: Australia

Re: ACT for Web - Get the current contact

I think this is one of the reasons there are so few add-ons for APFW ... and, in a way, it prevents a larger uptake of Web and cloud users.

Even for non-web, it would be a good addition if the SDK supported server plugins that could detect user states and events fired from LAN or Web clients and respond accordingly
Bronze Super Contributor
Posts: 1,231
Country: USA

Re: ACT for Web - Get the current contact

Mark,


To get the current contact use this code in the Page_load event
 

Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
If Not Me.IsPostBack Then
        ' we know we're on a contact detail view, so get the current contact.
Dim contacts As ContactList = ACTSessionManager.Framework.Contacts.GetContactsByID(Nothing, New Guid() {New Guid(ACTSessionManager.CurrentContactID)})

If contacts IsNot Nothing AndAlso contacts.Count > 0 Then

' Get the current contact
Dim currentContact As Act.Framework.Contacts.Contact
CurrentContact = contacts(0)

' Bind the contact to our Grid Control
Me.DataBindGridEX(currentContact, CustomTableName)
End If
End If
End Sub

 

Hope this helps

-- Jim Durkin

www.DurkinComputing.com

New Member
Posts: 11
Country: USA

Re: ACT for Web - Get the current contact

Fantastic Jim,

 

I had already written this in C#, but had not had a chance to test it:

 

ContactList list = ActSession.Framework.Contacts.GetContactsByID(null, new Guid[1] { new System.Guid(ActSession.CurrentContactID) });