Search code examples
c#.netpodio

Podio .Net CreateItem reference


I'm trying to create a new item in Podio using .Net for an app that uses an app field that is referenced from another app ("sending-location"). I keep getting an error

error 400, field.app.invalid, the referenced item is not valid.

I'm trying to hard code the id value for testing purposes but to no avail have I managed to get this to work. if I remove the app field I'm able to create the item, but I need that field.

My code is provided below:

Item myNewItem = new Item();            

// App Field with external_id 'sending-location' 
var clientField = myNewItem.Field<AppItemField>("sending-location");                                   
clientField.ItemId = 15;            
           
// Text Field with external_id 'status' 
var statusField = myNewItem.Field<CategoryItemField>("status");
statusField.OptionId = 1;

//Text Field with external_id 'priority' 
var priorityField = myNewItem.Field<CategoryItemField>("priority");
if(((DropDownList)fvSupportRequest.FindControl("ddlPriority")).SelectedValue == "Standard")            
    priorityField.OptionId = 1;
else
    priorityField.OptionId = 2;

// Text Field with external_id 'receiving-referring-location' 
var detailsField = myNewItem.Field<TextItemField>("receiving-referring-location");
detailsField.Value = ((TextBox)fvSupportRequest.FindControl("txtLocId")).Text + "<br />" 
                   + ((TextBox)fvSupportRequest.FindControl("txtSuppDetails")).Text;          

int itemId = podio.ItemService.AddNewItem(podio_eReports_AppId, myNewItem);

Solution

  • You are using the app_item_id and not the item_id. Go to your item, click the "Actions" dropdown at the top and pick the "Developer" option. There you can see the item_id -- it will be a much larger number