Error 1012: 'Required object attribute(s) are missing from your request: values.'
I'm having difficulties with the AddRows method in Smartsheet's C# SDK. I have been getting the error code 1012 with the message 'Required object attribute(s) are missing from your request: values." I have seen others post similar issues but with 'cell.value' as the missing attribute. In my case, what is 'values' supposed to represent?
Best Answer
-
Hi Joe,
It could be that
opportunity.TeamMembers
in your code is actually null.That would result in the
cell.values
property being missing for the request (as you noted in your first post!)Using ObjectValue is correct for a MultiSelect drop-down. Here's an example of how to specify the object Value & type in C#: https://smartsheet-platform.github.io/api-docs/?csharp#objectvalue-object
If this hasn't helped, you may want to reach out in the Stack Overflow Community (see here), or to the email address listed on this page (here).
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
Answers
-
Hi Joe,
Would it be possible to see your request? (Deleting any of the sensitive data).
Here's the API Documentation on how to AddRows: https://smartsheet-platform.github.io/api-docs/?csharp#add-rows
There's an example of what it might look like in C# on the right, and an example of what's required listed:
Cells: -- if specified, must be an array of Cell Objects (see here) , with the following attributes:
- columnId (required)
- One of the following (required):
- formula - or -
- value
Could you be missing the "Value" portion from the list above?
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
-
Hi Genevieve, I'll copy my code in the next post. I keep getting a 403 error when trying to attach an image or .txt file of the code.
I think that my issue might be from using ObjectValue for one of the cells. I'm doing that because it's for a multi-picklist and I followed the SDK documentation on github:
-
// Helper function to build rowsToAdd list
static Row ScheduleRowToAdd(EAOpportunity opportunity)
{
var addOpportunityNo = new Cell
{
ColumnId = scheduleColumnMap["Opportunity No."],
Value = opportunity.OpportunityNumber //string
};
var addOpportunityStatus = new Cell
{
ColumnId = scheduleColumnMap["Opportunity Status"],
Value = opportunity.OpportunityStatus //string
};
var addOnsiteDate = new Cell
{
ColumnId = scheduleColumnMap["Onsite Date"],
Value = opportunity.OnsiteDate //DateTime
};
var addOwner = new Cell
{
ColumnId = scheduleColumnMap["SSC Owner"],
Value = opportunity.Owner //string
};
var addTeamMembers = new Cell
{
ColumnId = scheduleColumnMap["Team Members"],
ObjectValue = new MultiPicklistObjectValue(opportunity.TeamMembers) //IList<string>
};
var addRegion = new Cell
{
ColumnId = scheduleColumnMap["Region"],
Value = opportunity.Region //string
};
var addWHOTO = new Cell
{
ColumnId = scheduleColumnMap["Sales & Service Center"],
Value = opportunity.Whoto //string
};
var addCustomer = new Cell
{
ColumnId = scheduleColumnMap["Customer"],
Value = opportunity.Customer //string
};
var addClosureDate = new Cell
{
ColumnId = scheduleColumnMap["Closure Date"],
Value = opportunity.ClosureDate //DateTime
};
var rowToAdd = new Row
{
ToTop = true,
Cells = new Cell[] { addOpportunityNo, addOpportunityStatus, addOnsiteDate, addOwner, addTeamMembers, addRegion, addWHOTO, addCustomer, addClosureDate }
};
return rowToAdd;
}
-
Hi Joe,
It could be that
opportunity.TeamMembers
in your code is actually null.That would result in the
cell.values
property being missing for the request (as you noted in your first post!)Using ObjectValue is correct for a MultiSelect drop-down. Here's an example of how to specify the object Value & type in C#: https://smartsheet-platform.github.io/api-docs/?csharp#objectvalue-object
If this hasn't helped, you may want to reach out in the Stack Overflow Community (see here), or to the email address listed on this page (here).
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
-
Yep, you're right! Some of my lists that I used to populate ObjectValues were empty. Thanks!
-
Great! Glad you were able to sort it out. 🙂
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.2K Get Help
- 419 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 141 Just for fun
- 58 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives