A great thanks to @Andreas for answering my question at Podio : Troubles assigning reference for a Relationship app field, it helped me finding the special settings for all podio app fields.
Anyway, I still can't assign referenced apps to relationship app fields.
I've tried to create app with all the fields the following way :
$attributes = array(
"space_id" => $ws->space_id,
"config" => array(
"icon" => DEFAULT_APP_ICON,
"item_name" => "Test App",
"name" => "TestApp"
),
"fields" => array(
array (
"type" => "app",
"external_id" => "test-reference-field",
"config" => array (
"label" => "Test field",
"settings" => array(
"referenced_apps" => array(array("app_id" => 10048654))
)
)
)
)
);
$app = new PodioApp($attributes);
But it does not create the app at all in the given workspace, so I created the app by calling static create() method instead:
$app = PodioApp::create($attributes);
Indeed, the app is created in the right workspace but the referenced app is not linked at all. So, would it be an API bug or anything else I skipped in my code? Any help would be appreciated
Thanks
The documentation is wrong and you should be using referenceable_types
for your settings key and the value should just be an array of app_ids.
$attributes = array(
"space_id" => $ws->space_id,
"config" => array(
"icon" => DEFAULT_APP_ICON,
"item_name" => "Test App",
"name" => "TestApp"
),
"fields" => array(
array (
"type" => "app",
"external_id" => "test-reference-field",
"config" => array (
"label" => "Test field",
"settings" => array(
"referenceable_types" => array(233461, 233464)
)
)
)
)
);
$app = PodioApp::create($attributes);