Hi Saumyajeet,
Is it possible to retrieve the list before the JavaScript action and passing it into the action as a parameter? That would be the recommended approach here.
As pointed out by Marius you won't be able to fetch references of 1-* association from parent directly as they are not stored there. You can alternatively fetch it as shown in code below -
export async function JS_Catalog(catalog) {
// BEGIN USER CODE
// Catalog has many CatalogItems
// Instead of catalog.getReferences("MainModule.CatalogItem"));
console.info(`Catalog: ${catalog.get("Name")}`); // Name is attribute in Catalog entity
mx.data.get({
guid: catalog._guid,
path: "MainModule.CatalogItem_Catalog",
callback: objs => {
objs.forEach(obj => {
console.info(`Col: ${obj.get("Name")}`); // Name is attribute in CatalogItem entity
})
}
})
// throw new Error("JavaScript action was not implemented");
// END USER CODE
}