Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Microsoft Dataverse
Unanswered

Is it possible to patch the CDS standard "Status" column from a canvas app?

(0) ShareShare
ReportReport
Posted on by

I have googled all over the place, watched videos etc and I'm just not getting this to work. I can't even find the optionsetvalues because there are no elipses in the field info box to click like most of the explanations on line say to use. I followed Daniel Christian's video on this topic with option sets and dug into the dynamics admin menu and found the field but even there, there's no edit button for me to look at the actual values. I've tried using 0 and 1 but powerapps tells me it's the wrong data type. Is this futile? I guess I could just use custom columns for what I'm trying to do but this seems like it should be very very straight forward. Thanks in advance.

 

  • Community Power Platform Member Profile Picture
    on at
    Re: Is it possible to patch the CDS standard "Status" column from a canvas app?

    Sorry. I have to retract that statement. The "monitor" page indicated that a particular Patch() statement was getting an error so I thought this was the case. But it was actually a problem with a different Patch() statement than the one monitor highlighted. Misleading. Anyway, it does work.

  • Community Power Platform Member Profile Picture
    on at
    Re: Is it possible to patch the CDS standard "Status" column from a canvas app?

    I'm pretty sure that Canvas Apps can no longer do this.  I've tried every conceivable way with Patch(). Not sure when exactly they changed it, but I think if you try your code above, you'll get errors setting statecode and statuscode.

  • Community Power Platform Member Profile Picture
    on at
    Re: Is it possible to patch the CDS standard "Status" column from a canvas app?

    I gave up on using the status column for what I was trying to do and just made a custom two option column. What I'm doing with it is fairly simple...make a templatefill flash or not flash. The status column, given its complexity, seems like killing a bug with a sledgehammer. Thank you for your help though.

  • GarethPrisk Profile Picture
    2,826 on at
    Re: Is it possible to patch the CDS standard "Status" column from a canvas app?

    You can set the default status using the Defaults() function in your patch.

    Patch(Accounts, Defaults(Accounts), {name: "Account Name"})

    If you are trying to explicitly set the Status, you may need to consider:

    • Setting both the statecode and statuscode fields at the same time
      • There are not the same thing
      • statecode is typically whether the record is Active (0) or Inactive (1)
      • statuscode describes more of the 'Status Reason'
    • The statecode and statuscode values are paired, and you'll need to know what are valid pairings
      • Cannot set an 'active' statuscode with the 'Inactive' statecode, for example
    • You can typically reference the Option Set  / Status fields by referencing the field
      • statecode: 'Status (Accounts)'.Inactive,
      • statuscode: 'Status Reason (Accounts)'.Inactive
    • It does appear as though Canvas apps, and Patches, cannot set a State/Status code for create (unlike other API calls)
      • This may be due to a conflict with using Defaults()
      • If you don't use Defaults(), you'll have to play whack-a-mole to determine all the fields it wants set
    • You can, however, Patch the Account and immediately update the status
      • See below

    Create and then Update Status (using Account in CDS, as example)

    UpdateContext(
     {
     locAccount: Patch(
     Accounts,
     Defaults(Accounts),
     {name: "Inactive Account"}
     )
     }
    );
    Patch(
     Accounts,
     locAccount,
     {
     statecode: 'Status (Accounts)'.Inactive,
     statuscode: 'Status Reason (Accounts)'.Inactive
     }
    )

    MSFT Docs on Entity State/Status

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Microsoft Dataverse

#1
mmbr1606 Profile Picture

mmbr1606 22 Super User 2025 Season 1

#2
stampcoin Profile Picture

stampcoin 17

#3
ankit_singhal Profile Picture

ankit_singhal 11 Super User 2025 Season 1

Overall leaderboard

Featured topics