Need a little help on the scripting syntax to push referenced field ids while writing payload to send data in Algolia using Webhooks(Rules).
Parent/Child Usecase (One-Many Relationship):
Category Schema (i.e Parent) references Subcategory Schema (i.e Child)
On Trigger of Content updation in Category Entity I want to take the Action to push the payload as defined below related subcategory ids (NOT THE CONTENT OF SUBCATEGORY, BUT JUST THE IDs)
Script(JSON.stringify(
{
"cateeorytitle": `${event.data.title['zh-TW']}`
"subcategory_id": `${event.data.subcategory['zh-TW']}`
}
))
The above dosen’t even push the array of Ids of children subcategory.
This is where I need your help
MAY BE I NEED TO USE A BETTER SYNTAX FOR ACCESSING THE CHILD ARRAY IDS
subcategory_id":
${event.data.subcategory[‘zh-TW’]}`
PFA the screenshots
I have highlighted in green the Parent Trigger leads to Child Ids being pushed in algolia via scripting
Algolia Result
Squidex Action Payload Definition (Scripting Code)
I checked using the GraphQL API Playground the Ids are stored in the Content