Is there any way to add or update the Predecessors column value by C# or Rest Api?

I have tried to update the value of predecessor column by C# sdk or rest api but i am not able to update the Predecessors field.below is the rest api call which i have used.

https://api.smartsheet.com/2.0/sheets/4701793453139844/rows

Body---

{
 "id": ROW_ID_WHERE_CREATING_PREDECESSOR,
 "cells": [
    {
        "columnId": COLUMN_ID,
        "objectValue": {
            "objectType": "PREDECESSOR_LIST",
            "predecessors": [
                    {
                        "rowId": ROW_ID_OF_PREDECESSOR_ROW,
                        "type": "FS"
                    }
                ]
        }
    }
 ]
}

I am getting the Error : {
    "errorCode": 1008,
    "message": "Unable to parse request. The following error occurred: Field \"objectValue\" was of unexpected type.",
    "refId": "18ov4541x88oa"
}

Answers

  • Hi @yashwant.shrimali

    I had a successful result using that exact same structure:

    {
      "cells": [
        {
         "columnId": xxxxx,
         "objectValue":{
             "objectType": "PREDECESSOR_LIST",
             "predecessors": [
                    {
                        "rowId": xxxxxx,
                        "type":"SS"
                    }
                  ]
              }
        }
         ]
    }
    


    I will note that if there's one character different, such as a space, after "objectType" I get the same error. Can you confirm that the structure you're trying is exactly formatted as you've shown above? Is it possible that there's an extra space or character somewhere on the objectType line?

    Cheers,

    Genevieve

    Join us at Smartsheet ENGAGE 2024 🎉
    October 8 - 10, Seattle, WA | Register now