EE - Forum Styles
fo
  • Not Answered

DeltaV Campaign Manager Webservice - ModifyCampaign throws Error

I have been working with writing to the Campaign Manager Webservice from an external client per guidance in DeltaV Books Online.

I am able to invoke the ModifyCampaign method to change the mode of a campaign to manual, but I seem to always get an exception 'Failed to Modify Campaign. Base Recipe is Not Editable'.

Strangely, the mode of the campaign does indeed get changed to manual as I had intended.  Rather than masking the error, I'd like to ensure I'm not doing something wrong.

Originally, I used:

...

ModifyCampaign(nodeName, campaignInfo, changeModeToManual, revertToPrevMode, UserInfo)

...

with the changeModeToManual argument set for true, but when I referred to the WCF SampleClient code included with DeltaV to see what I may be doing wrong, it instead showed

..

campaigninfo.BatchExecutionMode == BatchExecutionMode.Manual

ModifyCampaign(nodeName, campaignInfo, changeModeToManual, revertToPrevMode, UserInfo)

...

with changeModeToManual set to false.

I tried to emulate this because the sample client doesn't throw an error (appears to have a catch an try), and works.  The result was the set to manual mode did NOT happen AND I still got the exception.

This is a pretty esoteric topic. so I'm crossing my fingers someone else has seen this.  All other functions of interacting with the CMWS are working fine in my client, just this one nuisance exception is what I can't explain.

Thanks for your assistance.

1 Reply

  • I figured it out! The reason I was encountering the issue is as follows:  

    I created the campaignInfo object using the GetCampaignStatus  method.  In doing so, it populates the object with all the information about the campaign, which I assumed would be a good thing, since I need this information to make decisions like, if campaign mode is not manual, etc etc. The object is not actually a connection to the campaign, but a "form" (probably xml) containing the properties of the campaign at the moment of invocation.

    However, when calling the ModifyCampaign method, it seems to be best to send back that form with only the properties of interest to the method, rather than all of the properties. 

    To do this, I created a new blank  campaignInfo object, set the ID and BatchExecutionMode properties of the blank form to the ID and BatchExecutionMode properties of the complete form,

    then invoke the ModifyCampaign  method using the new targeted campaignInfo  object that only contains two bits of information: the required ID and BatchExecutionMode. 

    This is effectively what the sample code is doing, I just didn't realize it. 

    I also left the changeModeToManual argument as True, which is different than the sample client example, but it seems to work either way, provided that the BatchExecutionMode  property of the new targeted campaignInfo object is set to Manual before invoking the ModifyCampaign  method.

    Thanks.