web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)
Suggested Answer

update statuscode on Campaign Response in custom workflow activity

(0) ShareShare
ReportReport
Posted on by

I'm trying to reopen closed or canceled Campaign Response records in custom workflow activity using SetStateRequest. This is my code:

SetStateRequest state = new SetStateRequest();
state.State = new OptionSetValue(0);
state.Status = new OptionSetValue(1);
state.EntityMoniker = new EntityReference("campaignresponse", cr.Id);
service.Execute(state);

And I get an unexpected error "2 is not a valid status code for state code CampaignResponseState.Open on campaignresponse with Id ...". 2 is the old statuscode from this record. Why SetStateRequest cannot uodate record statuscode?

Thanks for reply.   

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    KZee Profile Picture
    on at

    Can't see anything wrong with the code.

    Try creating a new campaign response, close it and then run your code to see if it works.

    Also check the status reason (statuscode) field of Campaign Response entity to make sure all of the status reason exists.

  • Community Member Profile Picture
    on at

    Thank you for reply. I created a new record but the problem persists.

    I checked campaign response's statuscodes and statusreasons. They are correct.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans