Private
Readonly
lookupPrivate
Readonly
salesforcePrivate
Readonly
schemaSingle OmniScript record or array of OmniScript records to enhance
OmniScript records with their elements attached in an 'elements' property
// Attach elements to a single script
const script = await omniScriptAccess.find('a1r3X000000ABCDEFG');
const scriptWithElements = await omniScriptAccess.attachElements(script);
console.log(`Script has ${scriptWithElements.elements.length} elements`);
// Attach elements to multiple scripts at once (more efficient)
const scripts = await omniScriptAccess.filter({ type: 'Account' });
const scriptsWithElements = await omniScriptAccess.attachElements(scripts);
scriptsWithElements.forEach(script => {
console.log(`${script.type}/${script.subType} has ${script.elements.length} elements`);
});
Retrieve OmniScript elements matching the specified filter criteria. This method queries both OmniProcess and OmniScript element records and combines the results.
Criteria to filter elements: - scriptId: Limit to elements from specific script(s) - type: Filter by element type(s) like 'Step', 'Block', 'OmniScript', etc. - active: When true, only return elements from active scripts
Array of OmniScript element records matching the filter
// Get all elements from a specific script
const scriptElements = await omniScriptAccess.elements({
scriptId: 'a1r3X000000ABCDEFG'
});
// Get all OmniScript elements (embedded scripts) from active scripts
const embeddedScripts = await omniScriptAccess.elements({
type: 'OmniScript',
active: true
});
// Get all Step elements from multiple scripts
const steps = await omniScriptAccess.elements({
scriptId: ['a1r3X000000ABCDEFG', 'a1r3X000000HIJKLMN'],
type: 'Step'
});
Filter OmniScripts based on specified criteria. This method searches across both OmniProcess and OmniScript SObjects and returns matching records.
Optional filter criteria to search for OmniScripts. Can be a string ID, or an object with type, subType, language, version, and/or active properties.
Optional settings to control the returned data
Array of OmniScript records matching the filter criteria
// Find all active scripts of a specific type
const activeScripts = await omniScriptAccess.filter({
type: 'Account',
active: true
});
// Find all versions of a specific script
const scriptVersions = await omniScriptAccess.filter({
type: 'Account',
subType: 'Creation',
language: 'English'
});
// Find scripts with their elements
const scriptsWithElements = await omniScriptAccess.filter(
{ type: 'Account' },
{ withElements: true }
);
Optional
filter: OmniScriptIdentifierOptional
options: OmniScriptFilterOptionsFind a specific OmniScript record based on the provided identifier. This method looks through both OmniProcess and OmniScript SObjects and returns the matching record. If multiple records match the criteria, it will return the first one found (typically the one with the highest version number).
OmniScript identifier - can be a string ID or an object with type, subType, language, etc.
Optional settings: - withElements: When true, includes element records as part of the result - preferActive: When true, prioritizes active versions over exact ID matches
The matching OmniScript record
Error if no matching OmniScript record is found
// Find script by Salesforce record ID
const scriptById = await omniScriptAccess.find('a1r3X000000ABCDEFG');
// Find active version of a script by type information
const activeScript = await omniScriptAccess.find({
type: 'Account',
subType: 'Creation',
language: 'English',
active: true
});
// Find script with all its elements
const scriptWithElements = await omniScriptAccess.find(
'a1r3X000000ABCDEFG',
{ withElements: true }
);
Optional
options: OmniScriptFindOptionsFind active scripts that depend on the given script. This method is useful when you need to know which scripts use the provided script as an embedded subcomponent.
When a script is configured as reusable, it can be embedded in other scripts. This method helps identify those parent scripts that would be affected by changes to the given script.
The script specification to find dependencies for
Array of script IDs that depend on (embed) the provided script
// Find which active scripts are using a reusable script
const dependentScriptIds = await omniScriptAccess.findActiveDependentScripts({
type: 'ReusableComponent',
subType: 'Address',
language: 'English'
});
// Then you can load those scripts if needed
const dependentScripts = await Promise.all(
dependentScriptIds.map(id => omniScriptAccess.find(id))
);
Get all activated template records for the specified template names. This method retrieves Vlocity UI Templates that are used by OmniScripts, primarily for custom Lightning Web Components or custom HTML templates.
This method only returns templates that are marked as active in the org.
Array of template names to retrieve
Map of template names to their corresponding template records for easy lookup
// Find active templates used in a script
const templateNames = ['MyCustomTemplate', 'CommonHeader', 'Footer'];
const templates = await omniScriptAccess.findActiveTemplates(templateNames);
if (templates.has('MyCustomTemplate')) {
const template = templates.get('MyCustomTemplate');
console.log(`Template HTML: ${template.html}`);
} else {
console.log('Template not found or not active');
}
Private
queryOptional
script: OmniScriptIdentifierOptional
options: { Optional
limit?: numberPrivate
queryOptional
script: OmniScriptIdentifierOptional
options: { Optional
limit?: numberPrivate
queryOptional
filter: OmniScriptElementFilterPrivate
queryOptional
filter: OmniScriptElementFilter
Enhance OmniScript records by attaching their related element records. This creates a complete representation of the OmniScript with its structure and components.
This method is useful when you need to process an OmniScript's full definition, including all its elements, their hierarchies, and property sets.