The component id of the current view instance.
The configuration of the component to render.
The rendered HTML of the view.
The configuration of the view to render.
The viewFields of the view.
Triggers the execution of a function on the component. If the execution has to be confirmed by the user, the user will still have to do this.
// Execute the 'Order goods' function for where the stock is smaller than 150.
const pageData = CSL.multiRecord.getPageData();
var recordsToExecuteFunctionFor = Object.values(pageData).filter(pageItem => {
return pageItem.stock < 150;
});
CSL.listItemFunction.executeFunction('Order goods', recordsToExecuteFunctionFor);
// Deselect all rows. Select row with ids 1 and 6 and execute the 'Block Product' function.
CSL.multiRecord.deselectAll();
CSL.multiRecord.select(['1', '6']);
CSL.listItemFunction.executeFunction('Block Product');
// Execute a function and do something with the results.
CSL.listItemFunction.executeFunction('Block Product').then((response) => {
// Results from the function are here:
console.log(response.results);
}, (error) => {
error.errors.forEach((err) => {
console.error(err);
});
});
error when function is not found.
The name of the function to execute.
Optional
dataItems: { The records to execute the function for. This is only applicable for the type ItemFunction. When no value is passed, all the selected items are taken.
Whether the execution of the function should be forced. This will bypass any checks that would prevent the execution.
Optional
componentId: stringThe unique identifier of the multi record view.
Get list item function by its name.
const addToStockFunction = CSL.listItemFunction.getListItemFunction('AddToStock');
The name of the function.
Optional
componentId: stringThe id of the component to find the function on.
Set the condition that will determine if the function is enabled. With a disabled function, the button or icon representing the function cannot be clicked. This will be set for functions in header and in row. The condition will be checked when an interaction in the view is made. (loadComplete, value changed, refresh, ...). Because this is extra configuration on the list item function, the most logical place to call this function is in the configuration script.
To disable default Ometa buttons based on a condition, you need to prefix this with $$obiz-. Possible values are: $$obiz-New, $$obiz-Edit, $$obiz-Update, $$obiz-InlineEdit, $$obiz-Details, $$obiz-Refresh, $$obiz-Export, $$obiz-ContextSetter, $$obiz-AuditTrailDetails.
// Disable 'AddToStock' function after 17:00h.
const hourLimit = 17;
CSL.listItemFunction.setEnabledCondition('AddToStock', () => {
const currentHour = new Date().getHours();
return currentHour < hourLimit;
});
The name of the function.
The function to set as the check.
Rest
..._: any[]Optional
componentId: stringThe id of the component on which the function exists.
Set the condition that will determine if the function is enabled in the header. The condition will be checked when an interaction in the view is made. (loadComplete, value changed, refresh, ...). Because this is extra configuration on the list item function, the most logical place to call this function is in the configuration script.
To disable default Ometa buttons based on a condition, you need to prefix this with $$obiz-. Possible values are: $$obiz-New, $$obiz-Edit, $$obiz-Update, $$obiz-InlineEdit, $$obiz-Details, $$obiz-Refresh, $$obiz-Export, $$obiz-ContextSetter, $$obiz-AuditTrailDetails.
CSL.listItemFunction.setHeaderEnabledCondition('AddToStock', (dataSet) => {
// Get the 'Broken'group.
const brokenItems = dataSet.groups.find((g) => g.value === 'Broken');
// Disable the 'AddToStock' function in the header if there are 3 or more broken items.
return brokenItems ? brokenItems.length < 3 : true;
});
The name of the function.
The function to set as the check.
Rest
..._: any[]Optional
componentId: stringThe id of the component on which the function exists.
Sets the condition for a header function. The condition will be checked when an interaction in the view is made. (loadComplete, value changed, refresh, ...). Because this is extra configuration on the list item function, the most logical place to call this function is in the configuration script.
// Just set a new icon.
CSL.listItemFunction.setHeaderIconCondition(
'AddToStock',
() => 'fab fa-android'
);
// Conditionally set an icon based on the amount of selected rows.
CSL.listItemFunction.setHeaderIconCondition(
'AddToStock',
() => {
let selected = CSL.multiRecord.getSelectedItems(componentId);
if(selected.length > 2) {
return 'fas fa-eye';
} else {
return 'fas fa-eye-slash';
}
});
The name of the function to set the condition on.
The condition that returns a string.
Optional
componentId: stringThe id of the component.
Sets the hide condition for a function in the header. The condition will be checked when an interaction in the view is made. (loadComplete, value changed, refresh, ...). Because this is extra configuration on the list item function, the most logical place to call this function is in the configuration script.
To hide default Ometa buttons based on a condition, you need to prefix this with $$obiz-. Possible values are: $$obiz-New, $$obiz-Edit, $$obiz-Update, $$obiz-InlineEdit, $$obiz-Details, $$obiz-Refresh, $$obiz-Export, $$obiz-ContextSetter, $$obiz-AuditTrailDetails.
CSL.listItemFunction.setHeaderVisibilityCondition('AddToStock', (dataSet) => {
// Get the 'Broken'group.
const brokenItems = dataSet.groups.find((g) => g.value === 'Broken');
// Hide the 'AddToStock' function in the header if there are 3 or more broken items.
return brokenItems ? brokenItems.length < 3 : true;
});
The name of the function.
The hide condition to set on the function.
Rest
..._: any[]Optional
componentId: stringThe id of the component.
Set the condition that will determine if the function is enabled in the row. The condition will be checked when an interaction in the view is made. (loadComplete, value changed, refresh, ...). Because this is extra configuration on the list item function, the most logical place to call this function is in the configuration script.
To disable default Ometa buttons based on a condition, you need to prefix this with $$obiz-. Possible values are: $$obiz-Edit, $$obiz-Update, $$obiz-Details, $$obiz-ContextSetter, $$obiz-AuditTrailDetails.
CSL.listItemFunction.setRowEnabledCondition('AddToStock', (data) => data.Active === 'True');
The name of the function.
The function to set as the check.
Rest
..._: any[]Optional
componentId: stringThe id of the component on which the function exists.
Sets the condition for a row function. The row data will be sent with the condition. The condition will be checked when an interaction in the view is made. (loadComplete, value changed, refresh, ...). Because this is extra configuration on the list item function, the most logical place to call this function is in the configuration script.
// Just set a new icon.
CSL.listItemFunction.setRowIconCondition(
'AddToStock',
() => 'fab fa-android',
);
// Conditionally set an icon based on the productActive value
CSL.listItemFunction.setRowIconCondition(
'AddToStock',
(row) => {
if(row.data['productActive']) {
return 'fas fa-eye';
} else {
return 'fas fa-eye-slash';
}
})
The name of the function to set the condition on.
The condition to set on the row function.
Optional
componentId: stringThe id of the component.
Sets the hide condition for a function in a row. The condition will be checked when an interaction in the view is made. (loadComplete, value changed, refresh, ...). Because this is extra configuration on the list item function, the most logical place to call this function is in the configuration script.
To hide default Ometa buttons based on a condition, you need to prefix this with $$obiz-. Possible values are: $$obiz-Edit, $$obiz-Update, $$obiz-Details, $$obiz-ContextSetter, $$obiz-AuditTrailDetails.
CSL.listItemFunction.setRowVisibilityCondition('AddToStock', (rowData) => rowData['Active'] === 'True');
The name of the function.
The hide condition to set on the function.
Rest
..._: any[]Optional
componentId: stringThe id of the component.
Sets the hide condition for a function. This will be set for functions in the header and in row. The condition will be checked when an interaction in the view is made. (loadComplete, value changed, refresh, ...). Because this is extra configuration on the list item function, the most logical place to call this function is in the configuration script.
To hide default Ometa buttons based on a condition, you need to prefix this with $$obiz-. Possible values are: $$obiz-New, $$obiz-Edit, $$obiz-Update, $$obiz-InlineEdit, $$obiz-Details, $$obiz-Refresh, $$obiz-Export, $$obiz-ContextSetter, $$obiz-AuditTrailDetails.
// Hide 'AddToStock' function after 17:00h.
const hourLimit = 17;
CSL.listItemFunction.setVisibilityCondition('AddToStock', () => {
const currentHour = new Date().getHours();
return currentHour < hourLimit;
});
The name of the function.
The hide condition to set on the function.
Rest
..._: any[]Optional
componentId: stringThe id of the component.
Generated using TypeDoc
This class supports the functionality for custom scripting on list item functions. You can access all the methods by using the namespace
CSL.listItemFunction
.