Script 1
const fibery = context.getService('fibery');
console.log(args.currentEntities)
for (const entity of args.currentEntities) {
const name = entity['Name'];
const creationDate = entity['Creation Date'];
console.log("Name: ", name);
console.log("Creation Date: ", creationDate)
}
Result:
[
{
'Created By': { Name: 'ganuongphap', Id: '7b4f2510-dc1f-4b19-b6ff-a790b4ff3565' },
'Public Id': '23',
Id: '5bd925d0-1980-11ee-ad19-ab4956e8c55f',
'Creation Date': '2023-07-03T09:02:51.087Z',
Test: null,
'Modification Date': '2023-07-03T09:02:51.087Z',
Rank: 7712584211451303,
Name: null,
Type: 'Customer Feedback/Conversation'
}
]
Name: null
Creation Date: 2023-07-03T08:43:03.526Z
Script 2
I try using this script to get all field values for an entity, name
is still null
:
const fibery = context.getService('fibery');
// get entire schema
const schema = await fibery.getSchema();
// get specific database (type) name
const typeName = args.currentEntities[0].type;
// filter the schema for the specific type and get all field names
const fields = schema['typeObjects'].filter((obj) => obj.name == typeName)[0]['fieldObjects'].map((field) => field.name);
// get all entities with all fields
const entitiesWithAllFields = await fibery.getEntitiesByIds(typeName, args.currentEntities.map((entity) => entity.id), fields);
// send result to the browser console
console.log(entitiesWithAllFields);
Result:
[
{
'Customer Feedback/name': null,
'fibery/modification-date': '2023-07-03T09:01:55.934Z',
'Collaboration~Documents/References': [],
'fibery/id': '3afa8930-1980-11ee-ad19-ab4956e8c55f',
Id: '3afa8930-1980-11ee-ad19-ab4956e8c55f',
'fibery/created-by': { Name: 'ganuongphap', Id: '7b4f2510-dc1f-4b19-b6ff-a790b4ff3565' },
'fibery/creation-date': '2023-07-03T09:01:55.934Z',
'Customer Feedback/Test': null,
'fibery/public-id': '22',
'fibery/rank': 7712584210451303
}
]
Any idea why is that? I expect it to return TEST NAME
here. I want to do some automation based on the value of the field here.