Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

How to set a Quote in Active State with CWA

Posted on by Microsoft Employee

Hi everyone,

I wrote a CWA to help bulk edit records, regardless their state.

Everything works fine exept for active quotes. If a quote is active and in progress, I put it in draft state, do the update and try to reactivate it via C# code:

SetStateRequest state = new SetStateRequest
                    {
                        State = new OptionSetValue(attribStateCode),     //1
                        Status = new OptionSetValue(attribStatusCode),   //1
                        EntityMoniker = entRef
                    };
                    service.Execute(state);


The error message I get is quite confusing:

1 is not a valid status code for state code QuoteState.Active

Because statuscode 1 == In Progress.

Does anyone know what I am doing wrong?

*This post is locked for comments

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to set a Quote in Active State with CWA

    Well...nevermind... I just realized, that the option set value of "In Progress" for Status "Active" is not '1' but '2'...

    That does not realy make sense to me because my code reads the actual OptionSetValue and it reads '1'.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans