Home > Software design >  Update Status Column in Dataverse
Update Status Column in Dataverse

Time:05-27

Currently, I'm facing a problem with DataVerse. I try to update the pre-defined statuscode column through the Web API using C# (and Postman).

I've tried to update with these lines of code

{
    "statuscode": 1
}

The error is

1 is not a valid status code for state code (Entity)State.Inactive on (Entity) with Id.

Can anyone help me?

Thanks!

CodePudding user response:

Setting the statuscode, you always have to include the according statecode. The error message you receive suggest that the current statecode and statuscode signify an inactive state and status (statecode = 1 and statuscode = 2).

To set the record to active, try setting the statecode to 0.

{ "statecode" : 0, "statuscode" : 1}

Valid statecode and statuscode combinations are varying across Dataverse entities so you need to make sure you pick the correct one for your case.

  • Related