Community
Showing results for 
Search instead for 
Do you mean 
Reply

Unable to Insert History

Nickel Super Contributor
Posts: 352
Country: Canada

Unable to Insert History

Hi All,

 

I saw this error posted and never a resolution to it yet, but I must be missing something.  The call to Update() fails here with an "Unable to Insert History"

 

This code is used within a Plugin - any thoughts?

 

Thanks,

Len

 

void Histories_CreateHistoryComplete(History history)
{
ContactList clOpp;
Opportunity oppThis;

if (history.OpportunityList != null && history.OpportunityList.Count > 0)
{
if (history.ContactList == null || history.ContactList.Count < 0)
{
// get the first opp from this history
oppThis = history.OpportunityList[0];

// get the contacts on this opp
clOpp = ACTAPP.ActFramework.Opportunities.GetOpportunityContacts(new Opportunity[] { oppThis });

// set the history to these contacts
if (clOpp != null && clOpp.Count > 0)
{
history.ContactList = clOpp;
history.Update();
}
}
}
}

Len Kamerman
ACT! Certified Consultant

Act E-mail Marketing Trainining Course:

http://actsoftware.training
Employee
Posts: 1,163
Country: USA

Re: Unable to Insert History

I copied the code that you're using verbatim and I'm not getting an error. Is this occurring every time an opportunity history is created without any contacts associated with it? When you debug through is the history or opportunity object you're passed null? Is this a new opportunity?

 

To reproduce I created a new history under an existing opportunity, associated 3 other opportunities with it but no contacts, this executed without an issue. 

Matthew Wood
Act! SDK Support
Community Moderator
Bronze Elite Contributor
Posts: 2,115
Country: United_Kingdom

Re: Unable to Insert History

Len, could it be due to an ACL issue with any of the Contacts linked to the Opp?
Vivek Gargav
Caldere Associates Ltd.
www.caldere.com
vgargav@caldere.com
My Blog