Answered by:
change the status of a campaign response using sdk

Question
-
Hi All,
I am trying to change the status of a campaign response using the SDK. I am not sure if the following will work:
Dim crstatus As StatusProperty = New StatusProperty
crstatus.Name = "statuscode"
crstatus.Value = New Status
crstatus.Value.Value = 2Dim crstate As StateProperty = New StateProperty
crstate.Name = "statecode"
crstate.Value = CampaignResponseState.Closed
camp_resp.Properties.Add(crstatus)
camp_resp.Properties.Add(crstate)Can anyone see what i am doing wrong? I keep getting a 'server unable to process request' error :-(
thank you all in advance! :-)
Tuesday, March 23, 2010 9:28 AM
Answers
-
Use SetStateCampaignRequest & SetStateCampaignResponse for performing the action.
refer http://technet.microsoft.com/en-us/library/cc154679.aspx
Regards
Vinoth- Marked as answer by bshah1985 Tuesday, March 23, 2010 10:12 AM
Tuesday, March 23, 2010 9:42 AM
All replies
-
Use SetStateCampaignRequest & SetStateCampaignResponse for performing the action.
refer http://technet.microsoft.com/en-us/library/cc154679.aspx
Regards
Vinoth- Marked as answer by bshah1985 Tuesday, March 23, 2010 10:12 AM
Tuesday, March 23, 2010 9:42 AM -
Thank you! :-) it's working now - amended code:
Dim crstate As SetStateCampaignResponseRequest = New SetStateCampaignResponseRequest
crstate.CampaignResponseState = CampaignResponseState.Closed
crstate.CampaignResponseStatus = 2
crstate.EntityId = New Guid(campid)
service.Execute(crstate)Tuesday, March 23, 2010 10:12 AM -
ok - another issue now - i have managed to change the status of the record to being closed/completed etc - but if i try to reactivate the campaign response i get an error saying "The object cannot be updated becuase it is read-only."
If i try on a standard CRM campaign response, i am able to reactivate a campaign response, but if i use my code to close the campaign response i get the error above! :-(any ideas?
Tuesday, March 23, 2010 3:23 PM -
How do you reactivate the campaign response? Can you provide the code?
My blog : http://mscrmtools.blogspot.comYou will find:Bulk Delete Launcher View Layout replicator ISV.Config Manager Form Javascript Manager Assembly Recovery And others (use tool tag on my blog) Tuesday, March 23, 2010 3:28 PMModeratorim not reactivating using ay custom code. I use this code to close the campaign response:
Dim crstate As SetStateCampaignResponseRequest = New SetStateCampaignResponseRequest
crstate.CampaignResponseState = CampaignResponseState.Closed
crstate.CampaignResponseStatus = 2
crstate.EntityId = New Guid(campid)
service.Execute(crstate)But then try to use the standard CRM button to reactivate the campaign response.
Tuesday, March 23, 2010 3:30 PM