Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Avid Listener
john_d
Posts: 9
Country: United States
Message 1 of 5 (2,005 Views)

Deleting an opportunity with the SDK

I'm using ACT Version 12.0.0.401

 

I'm writing in vb.net (a visual studio 2005 app)

 

I've been able to create contacts, create opportunities, update field values for opportunities all through the SDK.

 

How do I delete a single opportunity if I know the opportunityID?

 

I thought it would be something like:

 

 

 

Dim ids(1) As Guid

ids(0) = moppGUID   <--- a GUID variable

 

Dim oppByID As Act.Framework.Opportunities.OpportunityList = actfwk.Opportunities.GetOpportunitiesByID(Nothing

, ids)

 

Dim id As Guid = oppByID.Item(0).ID

Dim

opp.delete  <--- doesn't exist

Thanks in advance!

opp As Act.Framework.Opportunities.Opportunity = oppByID.Item(0)

Please use plain text.
Employee
mwood
Posts: 1,163
Country: USA
Message 2 of 5 (1,802 Views)

Re: Deleting an opportunity with the SDK

I think this is the correct way.

 

Opportunity o = ActApp.ApplicationState.CurrentOpportunity;
ActApp.ActFramework.Opportunities.DeleteEntity(o);

Matthew Wood
Act! SDK Support
Community Moderator
Please use plain text.
Avid Listener
john_d
Posts: 9
Country: United States
Message 3 of 5 (1,772 Views)

Re: Deleting an opportunity with the SDK

Thanks for the quick reply Matt!

 

I'd like to delete the opportunity from an application that uses the SDK outside of the ACT! program.

 

When I see ".applicationstate.currentopportunity" and "Actapp."  in your example I think those are meant to be used when writing plugins or otherwise from within ACT!.

 

I'd like to delete the opportunity record from a .net application that stands apart from ACT!

 

Thanks in advance!

Please use plain text.
Bronze Super Contributor
vivek
Posts: 1,833
Country: United_Kingdom
Message 4 of 5 (1,544 Views)

Re: Deleting an opportunity with the SDK

Hi John,

 

You could try this (sorry its in C# I have completely forgotten my VB syntax), assuming you have your Opportunity by ID as opp and an instance of the ActFramework as oFram:

 

oFram.Opportunities.DeleteEntity(opp);

 

HTH

 

 

Vivek Gargav
Caldere Associates Ltd.
www.caldere.com
vgargav@caldere.com
My Blog
Please use plain text.
Employee
mwood
Posts: 1,163
Country: USA
Message 5 of 5 (1,542 Views)

Re: Deleting an opportunity with the SDK

I only included the first line where I retrieve the opportunity so the variable 'o' had some context, that could have been done a number of ways. Additionally in my second line, if you were using a stand alone .net application with only framework level access you can simply omit the ActApp and replace ActFramework with your instance of this object.

Matthew Wood
Act! SDK Support
Community Moderator
Please use plain text.