Question
Is it possible to use the Vantage data catalog in Advanced Script Rule?
Answer
It is possible to access a specific record. Here is a sample script for retrieving a data catalog record's column values into some field via the Advanced Script Rule in the document skill:
Context.GetField("MyField").Value = "";
const record = Context.GetCatalogRecord("catalog name", "recordId");
if (record && record.Fields)
{
let fields = [];
for (let name in record.Fields)
{
fields.push(name + ": " + record.Fields[name].join("; "));
}
Context.GetField("MyField").Value = fields.join("\r\n");
}
else
{
Context.GetField("MyField").Value = "Catalog record is not found";
}
Here const record = Context.GetCatalogRecord("catalog name", "recordId"); the first parameter is the catalog name, the second parameter is the record ID which can be captured using Vantage Processing REST API:
Vantage Processing REST API > Catalogs > Lists all available catalogs
Vantage Processing REST API > CatalogRecords > Lists a portion of the records in the specified catalog
and is specified when adding a record to the catalog via Public API:
Business Rules Automation > Object Model > GetCatalogRecord
Business Rules Automation > Object Model > Record