Community
Showing results for 
Search instead for 
Do you mean 
Reply

How to Clear an Activity via SDK

Loyal Listener
Posts: 19
Country: USA

How to Clear an Activity via SDK

I'd like to clear an activity and have it show up in history, but haven't been able to figure out how to supply the correct history type.

 

I'm using the following overload for ClearActivity():

 

   ClearActivity(Activity,CalendarDelegateGrantor,HistoryType,Boolean,DateTime,DateTime,String)

I want the history type to be the default history type for the activity. How do I determine what HistoryType value to pass?

 

Thanks!

Employee
Posts: 1,163
Country: USA

Re: How to Clear an Activity via SDK

[ Edited ]

You can use this:

 

HistoryType[] hType = ActApp.ActFramework.Histories.GetHistoryTypes();

 

To get a collection with all the potential history types in it, I already had some sample code doing this so below I'll paste the contents of the collection. There may be a custom HistoryType in here so yours may not match exactly.

 

[0]	{Library Document}	
[1]	{Call Attempted}	
[2]	{Call Completed}	
[3]	{Call Received}	
[4]	{Field Changed}	
[5]	{Access}	
[6]	{Letter Sent}	
[7]	{Meeting Held}	
[8]	{Meeting Not Held}	
[9]	{To-do Done}	
[10]	{To-do Not Done}	
[11]	{Timer}	
[12]	{Call Erased}	
[13]	{Contact Deleted}	
[14]	{Contact Updated}	
[15]	{Activity Updated}	
[16]	{Activity Deleted}	
[17]	{E-mail Sent}	
[18]	{Call Left Message}	
[19]	{Access Changed}	
[20]	{Personal Activity Completed}	
[21]	{Personal Activity Not Completed}
[22]	{Personal Activity Postponed}	
[23]	{Personal Activity Cancelled}	
[24]	{Vacation Completed}	
[25]	{Vacation Not Completed}
[26]	{Vacation Cancelled}
[27]	{Personal Activity Erased}	
[28]	{Vacation Erased}	
[29]	{Fax Sent}	
[30]	{Sent Sync}	
[31]	{Received Sync}	
[32]	{Replace Fields Log}	
[33]	{To-do Erased}	
[34]	{Meeting Erased}	
[35]	{Error}	
[36]	{Opportunity Won}	
[37]	{Opportunity Lost}	
[38]	{New Opportunity}	
[39]	{Opportunity Inactive}	
[40]	{Opportunity Stage Update}
[41]	{Quote}	
[42]	{E-mail Not Sent}	
[43]	{Fax Not Sent}	
[44]	{Data Moved}	
[45]	{Opportunity Opened}	
[46]	{Contact Linked}	
[47]	{Contact Unlinked}	
[48]	{Attachment}	
[49]	{E-mail Attachment}	
[50]	{Library Document Attached}
[51]	{E-mail Auto Attached}	
[52]	{Marketing Call Completed}	
[53]	{Marketing Call Not Completed}	
[54]	{Erased}	

 

Matthew Wood
Act! SDK Support
Community Moderator
Loyal Listener
Posts: 19
Country: USA

Re: How to Clear an Activity via SDK

So, given a particular activity type, how do I get an object reference to the corresponding history type?

 

For example, if the activity is "Meeting" I know the default history type would be "Meeting Held".

 

I have a few thousand activities I'm going to need to loop through, so I have to have the computer determine the history type for each..

 

How can I programmatically determine the default history type for each activity as I process it?

Employee
Posts: 1,163
Country: USA

Re: How to Clear an Activity via SDK

Unfortunately there isn't a default history type for activity types, but I can think of two different approaches that may solve this. First you could use the alternate overload for the ClearActivity method that doesn't require a history type. 

 

ClearActivity(IActivity,CalendarDelegateGrantor,History)

 

Alternatively, you could use a case statement, this will work better if the database your working on doesn't have a large amount of custom activty types. With this you could use the activity type as your switch and assign a history type based on the activity type.

 

 

Matthew Wood
Act! SDK Support
Community Moderator
Loyal Listener
Posts: 19
Country: USA

Re: How to Clear an Activity via SDK

If I use the alternate overload, what do I give it for the "History" parameter?

Employee
Posts: 1,163
Country: USA

Re: How to Clear an Activity via SDK

I haven't used it myself, it looks like it's requesting a history object, this could potential be a new history item. In hindsight this is probably the inferior solution since in order to create a history item you'd need a type, which puts your right back in the same boat.

Matthew Wood
Act! SDK Support
Community Moderator