Bridge: "Required object attribute(s) are missing from your request: row.id." (JSON Formatting)

I'm not kidding when I say I've spent 8+ hours on this. I'm no programmer so ChatGPT has been pretending to fix it for me, unsuccessfully. I have the problem narrowed down to the JSON output. ChatGPT keeps asking me to update my code and the HTTP Request body in various ways without much change. You'd think this would be something it would excel in, but it's not :p.
Can someone please help me modify my script and/or the HTTP Request Body I'm using so that it works properly?
The problem is with my Call API that is trying to write the data I have to the sheet in the wrong JSON format. Update sheet Documentation is here
API Log:"Required object attribute(s) are missing from your request: row.id."
Javascript Output:
[{"cells":[{"columnId":4090595125186439,"value":"en_US"},{"columnId":6564779755523975,"value":"US/Eastern"},{"columnId":284369337667462,"value":false},{"columnId":8447143662276584,"value":false},{"columnId":7039768778722204,"value":false},{"columnId":2536169151352758,"value":false}],"id":8400433777348481}]
I even added a "String tools: Compose Text" to see what output it's sending. that's below:
"{\n "rows": {"result":[{"cells":[{"columnId":4090595125186439,"value":"en_US"},{"columnId":6564779755523975,"value":"US/Eastern"},{"columnId":284369337667462,"value":false},{"columnId":8447143662276584,"value":false},{"columnId":7039768778722204,"value":false},{"columnId":2536169151352758,"value":false}],"id":8400433777348481}]}\n}\n"
Entire log:
Java element: (the only value you cannot see is {{states.startstate.call_api.make_api_call.response}} )
Javascript Code:
/*************************************************************************
Build Row Update Payload – returns a plain array of row update objects
*************************************************************************/
// 1) Validate inputs
if (!user || typeof rowId === 'undefined') {
throw new Error("Missing user or rowId");
}
if (!Array.isArray(columns)) {
throw new Error(columns is not an array (got ${typeof columns}));
}
// 2) Map column titles → IDs
const colMap = new Map(columns.map(c => [c.title, c.id]));
// 3) Collect non-empty cells
const cells = [];
function setCell(title, value) {
if (value != null && value !== "") {
cells.push({ columnId: colMap.get(title), value });
}
}
// 4) Populate enrichment fields
setCell("Company", user.company);
setCell("Department", user.department);
setCell("Title", user.title);
setCell("Locale", user.locale);
setCell("Role", user.role);
setCell("Timezone", user.timeZone);
setCell("Office Phone", user.workPhone);
setCell("Mobile Phone", user.mobilePhone);
setCell("Admin", !!user.admin);
setCell("Group Admin", !!user.groupAdmin);
setCell("Licensed", !!user.licensedSheetCreator);
setCell("Resource Viewer",!!user.resourceViewer);
// 5) Return a plain array of update objects (required format)
return [
{
id: Number(rowId), // Smartsheet requires numeric ID
cells
}
];
I'm simply trying to write the user details to the sheet using the API but it doesn't recognize the format I'm sending it in.
@SSFeatures this seems right up your alley if nobody else responds.
-Neil
Best Answers
-
@NeilKY your reference is incorrect
Use this:{{states.Build Row Update Payload.javascript.run_script.result}}
You see how the object you want is actually within a result object not in generic output from JS?
You can verify this pretty easily by using "copy as json" and pasting that into your postman body to test the references for which one works (if you didn't want to just compare with the documentation).
General feedback, don't use super long names in states / varibles / etc also avoid white space and special characters, nothing will make you madder than troubleshooting a broken workflow only to find that it is a double spacebar or trim spacebar character messing up your reference (which are invisible on the UI until you click into the field). You don't need to adopt programming conventions like camel or cap case but just try to be consistent with whatever you do.
You'll find this is extremely helpful on sheet references and columns as wellPrincipal Consultant | System Integrations
Prime Consulting Group
Email: info@primeconsulting.com
Follow us on LinkedIn! -
It looks like maybe you grabbed the module output instead of the run log data.
Module output (what you don't want):
{{states.Validate RSRRID.javascript.run_script}}
.
vs run log data (what you do want):
{{states.Validate RSRRID.javascript.run_script.result}}
-
Hi @NeilKY,
I just took a look and I think I know what's going on. There were a few issues in your original code, so I'll break them into sections.
Using the Result Output
As @prime_nathaniel and @Paul Newcome pointed out, you need to use
{{states.Build Row Update Payload.javascript.run_script.result}}
So that you get the actual result of your object.
If you look at this JSON output:
You'll notice that the actual rows and cells are being wrapped into this "result" object, which you don't want. So by updating your reference to use ".result", it will remove this from the output, so that the result will look like this.
{ "rows": [ { "cells": [ { "columnId": 4090595125186439, "value": "en_US" }, { "columnId": 6564779755523975, "value": "US/Eastern" }, …etc etc ], "id": 8400433777348481 } ] }
This Format is Incorrect
The format above is a little bit better, now that we removed the "results" from the payload. However, there are still a few other problems that we need to correct.
Let's look at the official format in the API documentation:
Then let's take this and paste it into a JSON formatter, and this is the result:
[ { "id": "6572427401553796", "cells": [ { "columnId": 7518312134403972, "image": { "altText": "New Alt Text" }, "value": "new value" }, …etc etc
Now let's compare the your format with the official API format.
API Format
Your Format
The big difference:
Yours has { "rows": at the beginning, whereas the API version does not. Theirs just goes straight into "[{ "cells":
For example, we would need to change this invalid request:
{ "rows": [ { "id": 4966390739505028, "cells": [ { "columnId": 5317213643034500, "value": "Hello World" } ] } ] }
Into this valid request:
[ { "id": 4966390739505028, "cells": [ { "columnId": 5317213643034500, "value": "Hello World" } ] } ]
Updating the Call
This is what @Darren Mullen pointed out. In your request body you're adding this "row" section, which shouldn't be here.
He mentioned this:
for that API call you don't use
{
"rows": xxxxx
}
You should just insert the payload from the output of the javascript, and I'd expect it to work as long as all your header information is correct.
So instead of
{ "rows": {{states.Build Row Update Payload.javascript.run_script}} }
So this should probably just be
{{states.Build Row Update Payload.javascript.run_script.result}}
Result
I also highly recommend @prime_nathaniel's advice about using Postman to manually test your API Calls. It's way easier than trying to debug everything in Bridge. Then once you have the API call working in Postman, you'll know how to translate it over into Bridge.
Hopefully this helps fix the problem!
Nathan Braun (Founder of SSFeatures) (nathan@ssfeatures.com) (LinkedIn)
SSFeatures makes Smartsheet way easier to use and it saves you hours of work every week. It adds essential features into Smartsheet to save you time. For example: — Auto Sorting — Sorting with Filters — Report PDF Generation — Copy and Paste Conditional Formats — Copy and Paste Automation Workflows — Column Manager — and so many more.
Answers
-
@NeilKY I believe the issue is in your HTTP Request Body in the Bridge module.
for that API call you don't use
{
"rows": xxxxx
}
You should just insert the payload from the outupt of the javascript, and I'd expect it to work as long as all your header information is correct.
Darren Mullen, Author of: Smartsheet Architecture Solutions
Get my 7 Smartsheet tips here
Take your Smartsheet knowledge to the next level and become an expert. Join the Smartsheet Guru Elite
-
I updated the API to:
{
"rows": {{states.Build Row Update Payload.javascript.run_script}}
}Error now is: 1012
"Required object attribute(s) are missing from your request: row.id."
Javascript log output:
[{"cells":[{"columnId":40905951251864XX,"value":"en_US"},{"columnId":65647797555239XX,"value":"US/Eastern"},{"columnId":2843693376674XX,"value":false},{"columnId":84471436622764XX,"value":false},{"columnId":70397687787232XX,"value":false},{"columnId":25361691513527XX,"value":false}],"id":84004337773484XX}]
output in compose text box (Since api doesn't show us what the output is, only that it failed)
"{\n "rows": {"result":[{"cells":[{"columnId":40905951251864XX,"value":"en_US"},{"columnId":65647797555239XX,"value":"US/Eastern"},{"columnId":2843693376674XX,"value":false},{"columnId":84471436622764XX,"value":false},{"columnId":70397687787232XX,"value":false},{"columnId":25361691513527XX,"value":false}],"id":84004337773484XX}]}\n}\n"
-Neil
-
@NeilKY Unsure if you copied from your original post, but it looks the same to me.
In the HTTP Request Body I'd expect you would just put in
{{states.Build Row Update Payload.javascript.run_script}}
Darren Mullen, Author of: Smartsheet Architecture Solutions
Get my 7 Smartsheet tips here
Take your Smartsheet knowledge to the next level and become an expert. Join the Smartsheet Guru Elite
-
Yeah, I tried them both.
{{states.Build Row Update Payload.javascript.run_script}}
AND
{
"rows": {{states.Build Row Update Payload.javascript.run_script}}
}
To be clear, the entire Javascript code was written by ChatGPT so the problem might be in the code itself.
It HAS to be something very simple…I'm so clueless when it comes to JSON and Java…
-Neil
-
Yes, hard to fully troubleshoot without being in the environment and seeing it live.
Darren Mullen, Author of: Smartsheet Architecture Solutions
Get my 7 Smartsheet tips here
Take your Smartsheet knowledge to the next level and become an expert. Join the Smartsheet Guru Elite
-
Agreed, however, you and @SSFeatures have surprised me in the past. Is there anything else you need to know to be better able to troubleshoot it?
It didn't seem like this, "grab user details and populate the sheet based on the row with a matching userID" would be a big task, when I first started.
-Neil
-
@NeilKY A bit complicated to really do it in this format with screenshots and not seeing live responses.
There's always this option:
Darren Mullen, Author of: Smartsheet Architecture Solutions
Get my 7 Smartsheet tips here
Take your Smartsheet knowledge to the next level and become an expert. Join the Smartsheet Guru Elite
-
I appreciate many of your trainings online (they're the best out there for Smartsheet) but this should be a simple typo so I don't think i need to go 1on1 yet. Maybe @SSFeatures or @Genevieve P. or some other mysterious person will see something blaring when they see it?
-Neil
-
@NeilKY your reference is incorrect
Use this:{{states.Build Row Update Payload.javascript.run_script.result}}
You see how the object you want is actually within a result object not in generic output from JS?
You can verify this pretty easily by using "copy as json" and pasting that into your postman body to test the references for which one works (if you didn't want to just compare with the documentation).
General feedback, don't use super long names in states / varibles / etc also avoid white space and special characters, nothing will make you madder than troubleshooting a broken workflow only to find that it is a double spacebar or trim spacebar character messing up your reference (which are invisible on the UI until you click into the field). You don't need to adopt programming conventions like camel or cap case but just try to be consistent with whatever you do.
You'll find this is extremely helpful on sheet references and columns as wellPrincipal Consultant | System Integrations
Prime Consulting Group
Email: info@primeconsulting.com
Follow us on LinkedIn! -
It looks like maybe you grabbed the module output instead of the run log data.
Module output (what you don't want):
{{states.Validate RSRRID.javascript.run_script}}
.
vs run log data (what you do want):
{{states.Validate RSRRID.javascript.run_script.result}}
-
Hi @NeilKY,
I just took a look and I think I know what's going on. There were a few issues in your original code, so I'll break them into sections.
Using the Result Output
As @prime_nathaniel and @Paul Newcome pointed out, you need to use
{{states.Build Row Update Payload.javascript.run_script.result}}
So that you get the actual result of your object.
If you look at this JSON output:
You'll notice that the actual rows and cells are being wrapped into this "result" object, which you don't want. So by updating your reference to use ".result", it will remove this from the output, so that the result will look like this.
{ "rows": [ { "cells": [ { "columnId": 4090595125186439, "value": "en_US" }, { "columnId": 6564779755523975, "value": "US/Eastern" }, …etc etc ], "id": 8400433777348481 } ] }
This Format is Incorrect
The format above is a little bit better, now that we removed the "results" from the payload. However, there are still a few other problems that we need to correct.
Let's look at the official format in the API documentation:
Then let's take this and paste it into a JSON formatter, and this is the result:
[ { "id": "6572427401553796", "cells": [ { "columnId": 7518312134403972, "image": { "altText": "New Alt Text" }, "value": "new value" }, …etc etc
Now let's compare the your format with the official API format.
API Format
Your Format
The big difference:
Yours has { "rows": at the beginning, whereas the API version does not. Theirs just goes straight into "[{ "cells":
For example, we would need to change this invalid request:
{ "rows": [ { "id": 4966390739505028, "cells": [ { "columnId": 5317213643034500, "value": "Hello World" } ] } ] }
Into this valid request:
[ { "id": 4966390739505028, "cells": [ { "columnId": 5317213643034500, "value": "Hello World" } ] } ]
Updating the Call
This is what @Darren Mullen pointed out. In your request body you're adding this "row" section, which shouldn't be here.
He mentioned this:
for that API call you don't use
{
"rows": xxxxx
}
You should just insert the payload from the output of the javascript, and I'd expect it to work as long as all your header information is correct.
So instead of
{ "rows": {{states.Build Row Update Payload.javascript.run_script}} }
So this should probably just be
{{states.Build Row Update Payload.javascript.run_script.result}}
Result
I also highly recommend @prime_nathaniel's advice about using Postman to manually test your API Calls. It's way easier than trying to debug everything in Bridge. Then once you have the API call working in Postman, you'll know how to translate it over into Bridge.
Hopefully this helps fix the problem!
Nathan Braun (Founder of SSFeatures) (nathan@ssfeatures.com) (LinkedIn)
SSFeatures makes Smartsheet way easier to use and it saves you hours of work every week. It adds essential features into Smartsheet to save you time. For example: — Auto Sorting — Sorting with Filters — Report PDF Generation — Copy and Paste Conditional Formats — Copy and Paste Automation Workflows — Column Manager — and so many more.
-
WOW! {{states.Build Row Update Payload.javascript.run_script.result}} WORKED!
I both can and cannot believe it was that simple. What a relief! Thank you ALL for the answers, everyone above. @SSFeatures , @prime_nathaniel , @Paul Newcome , @Darren Mullen . This information has been priceless! First, to help me fix my
simpleproblem. Second, to give me ideas on troubleshooting in the future. I will certainly be using postman to manually test my API Calls. Undocumented tips like that will make this much easier to use Bridge.-Neil
-
You're welcome! This was an awesome team effort lol, everyone had a piece of the puzzle.
Nathan Braun (Founder of SSFeatures) (nathan@ssfeatures.com) (LinkedIn)
SSFeatures makes Smartsheet way easier to use and it saves you hours of work every week. It adds essential features into Smartsheet to save you time. For example: — Auto Sorting — Sorting with Filters — Report PDF Generation — Copy and Paste Conditional Formats — Copy and Paste Automation Workflows — Column Manager — and so many more.
-
@NeilKY @SSFeatures @Paul Newcome Haha that's really cool that we all were able to provide a little piece of the puzzle!
Darren Mullen, Author of: Smartsheet Architecture Solutions
Get my 7 Smartsheet tips here
Take your Smartsheet knowledge to the next level and become an expert. Join the Smartsheet Guru Elite