Community
Showing results for 
Search instead for 
Do you mean 
Reply

Link Opportunity to Contact by SDK (or vice versa)

Accepted Solution Solved
Copper Contributor
Posts: 26
Country: Switzerland
Accepted Solution

Link Opportunity to Contact by SDK (or vice versa)

Hi all

 

I create a new opportunity and add a product with the following code:

 

 

    Public Shared Function AddOppo( _
        ByVal objACT As Act.Framework.ActFramework, _
        ByVal sActUser As String, _
        ByVal opName As String)

        Dim newOpp As Opportunity = Nothing
        Dim oProcList() As Process = objACT.StageManager.ActiveProcesses()
        Dim StageList() As Stage = oProcList(0).Stages
        Dim OppStat As OpportunityStatus = OpportunityStatus.Open
        Dim OppStage As Stage = StageList(3)
        Dim ACTuser As User = objACT.Users.GetUser(sActUser)

        newOpp = objACT.Opportunities.CreateOpportunity(opName, _
            OpportunityStatus.Open, OppStage, Now.AddDays(30), False)
        newOpp.OpenDate = Now
        newOpp.SetRecordManager(ACTuser)
        newOpp.Update()

        Dim op As OpportunityProduct = objACT.Products.OpportunityProductManager.CreateCustomEntity
        op.Name = "Project"
        op.Quantity = 1
        op.Cost = 0
        op.Price = 5000
        op.Discount = 0
        op.SetOpportunities(objACT.Opportunities.GetOpportunityAsOpportunityList(newOpp))
        op.Update()


    End Function

 

This works fine. But now I need to link this new opportunity to an existing contact of the ACT database.

 

I already have the contacts object and the opportunity object, but I can't find the method to build the link.

 

can someone please post a code sample?

 

Stefan

 

Stefan Koehli
ACT! Cerified Consultant
KÖHLI INFORMATIK AG

Accepted Solutions
Solution
Accepted by topic author skoehli
‎09-25-2015 03:20 AM
Employee
Posts: 1,163
Country: USA

Re: Link Opportunity to Contact by SDK (or vice versa)

All you should have to do is call the UpdateContacts method from your Opportunity object, it accepts an array of contact GUID's to add to the opportunity.

Matthew Wood
Act! SDK Support
Community Moderator

View solution in original post


All Replies
Solution
Accepted by topic author skoehli
‎09-25-2015 03:20 AM
Employee
Posts: 1,163
Country: USA

Re: Link Opportunity to Contact by SDK (or vice versa)

All you should have to do is call the UpdateContacts method from your Opportunity object, it accepts an array of contact GUID's to add to the opportunity.

Matthew Wood
Act! SDK Support
Community Moderator