CRM 4.0 codename field on Campaign entity

I tried updating codename field’s value on campaign entity in MS Dynamics CRM 4 however it did not save value for codename but was saving everything else.

Tried both in C# and on form (readonly, changed css) but in both cases it kept failing.

code sample

foreach (var camp in _campaigns.ToList())

// approach 1

camp.codename = “12345678”; = “Test Name”;

// approach 2

DynamicEntity _updateCampaign = new DynamicEntity(“campaign”);
_updateCampaign.Properties.Add(new KeyProperty(“campaignid”,new Key(camp.campaignid)));
_updateCampaign.Properties.Add(new StringProperty(“codename”, “9999999”));
_updateCampaign.Properties.Add(new StringProperty(“name”, “Test Name 2”));
TargetUpdateDynamic update = new TargetUpdateDynamic();
update.Entity = _updateCampaign;
UpdateRequest request = new UpdateRequest();
request.Target = update;
UpdateResponse response = (UpdateResponse)service.Execute(request);


Found out that update on codename field is not allowed on campaign entity

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>