3/17/2026 3:28:20 AM
|
| |
| slxdeveloper.com Community Forums |
|
| |
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
|
|
|
|
How to mimic Insert Association Action programatically?
Posted: 09 Feb 10 7:34 AM
|
Hi,
I am trying to create a new record in OpportunityCampaign when Converting a Lead To Opportunity. The code: if(opportunity != null) { IOpportunityCampaign opportunityCampaign = EntityFactory.Create(); opportunityCampaign.OpportunityId = opportunity.Id.ToString(); opportunityCampaign.CampaignId = "QDEV1A0003EL"; opportunityCampaign.Save(); }
When debugging, I get the following error: Microsoft JScript runtime error: Sys.InvalidOperationException: Cannot call get_statusCode when responseAvailable is false.
Any ideas?
I was looking at Opportunity.OpportunityCampaigns they are using Insert Association Action to insert a new campaign to an Opportunity. What else do I need to add to the code?
Thanks |
|
|
|
Re: How to mimic Insert Association Action programatically?
Posted: 12 Feb 10 5:22 AM
|
Not sure what the error message means but you might wanna try something like:
if(opportunity != null) { ICampaign campaign = EntityFactory.GetById<ICampaign>("QDEV1A0003EL");
IOpportunityCampaign opportunityCampaign = EntityFactory.Create<IOpportunityCampaign>(); opportunityCampaign.Opportunity = opportunity; opportunityCampaign.Campaign = campaign; opportunityCampaign.Save();
}
|
|
|
|
Re: How to mimic Insert Association Action programatically?
Posted: 12 Feb 10 10:51 AM
|
That error usually stems from a client timeout - did you get it during debugging? That sounds odd, and perhaps unrelated to your code you have posted there.
As per Jasons post if you are working with entities its best to instantiate an entity and then apply it as a property, not set the "OpportunityID" and CampaignId properties with string values.
|
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|