Items
The Items module allows widgets to access item-level data such as products and services. It provides item identifiers, types, and classification metadata. This module is commonly used to customize item selection and validation logic.
- Methods
- Events
Methods
Get Item Details
Retrieves data related to the current context. This method allows your widget to fetch record details, field values, or metadata required for rendering or processing logic.
- Fetch record information
- Read field values
- Access contextual module data
window.onload = function () {
ZFAPPS.extension.init().then(function(App) {
ZFAPPS.get('item').then(function (data) {
//response Handling
}).catch(function (err) {
//error Handling
});
});
}
| Property | Request |
|---|---|
| attribute_name1 | item.attribute_name1 |
| attribute_name2 | item.attribute_name2 |
| attribute_name3 | item.attribute_name3 |
| attribute_option_name1 | item.attribute_option_name1 |
| attribute_option_name2 | item.attribute_option_name2 |
| attribute_option_name3 | item.attribute_option_name3 |
| name | item.name |
| description | item.description |
| rate | item.rate |
| account_id | item.account_id |
Show More Supported Input Keys
| Property | Request |
|---|---|
| item_id | item.item_id |
| tax_id | item.tax_id |
| purchase_tax_id | item.purchase_tax_id |
| tags | item.tags |
| sku | item.sku |
| upc | item.upc |
| ean | item.ean |
| part_number | item.part_number |
| isbn | item.isbn |
| custom_fields | item.custom_fields |
| purchase_rate | item.purchase_rate |
| purchase_account_id | item.purchase_account_id |
| purchase_description | item.purchase_description |
| group_id | item.group_id |
| purchase_tax_rule_id | item.purchase_tax_rule_id |
| sales_tax_rule_id | item.sales_tax_rule_id |
| is_taxable | item.is_taxable |
| tax_exemption_code | item.tax_exemption_code |
| product_type | item.product_type |
| reorder_level | item.reorder_level |
| preferred_vendors | item.preferred_vendors |
| vendor_id | item.vendor_id |
| inventory_account_id | item.inventory_account_id |
| avatax_tax_code | item.avatax_tax_code |
| initial_stock | item.initial_stock |
| initial_stock_rate | item.initial_stock_rate |
| crm_owner_id | item.crm_owner_id |
| hsn_or_sac | item.hsn_or_sac |
| item_tax_preferences | item.item_tax_preferences |
| track_serial_number | item.track_serial_number |
| serial_numbers | item.serial_numbers |
| track_batch_number | item.track_batch_number |
| batches | item.batches |
| brand | item.brand |
| manufacturer | item.manufacturer |
| is_returnable | item.is_returnable |
| category_id | item.category_id |
| package_details | item.package_details |
| warehouses | item.warehouses |
| locations | item.locations |
| unit | item.unit |
| unit_id | item.unit_id |
| default_sales_unit_conversion_id | item.default_sales_unit_conversion_id |
| default_purchase_unit_conversion_id | item.default_purchase_unit_conversion_id |
| revenue_recognition_rule_id | item.revenue_recognition_rule_id |
| recognition_type | item.recognition_type |
| revenue_recognition_deferred_account_id | item.revenue_recognition_deferred_account_id |
| label_rate | item.label_rate |
| name_sec_lang | item.name_sec_lang |
| alias_name | item.alias_name |
| sat_item_key_code | item.sat_item_key_code |
| unitkey_code | item.unitkey_code |
| taxability_type | item.taxability_type |
| show_item_in_portal | item.show_item_in_portal |
| classes | item.classes |
| min_profit_percent | item.min_profit_percent |
| integration_references | item.integration_references |
| allowed_qty_customer | item.allowed_qty_customer |
| allowed_qty_salesperson | item.allowed_qty_salesperson |
| qty_frequency_customer | item.qty_frequency_customer |
| qty_frequency_salesperson | item.qty_frequency_salesperson |
| is_storage_location_enabled | item.is_storage_location_enabled |
| item_classification_code | item.item_classification_code |
| origin_country_code | item.origin_country_code |
| package_unit_code | item.package_unit_code |
| einvoice_import_id | item.einvoice_import_id |
| inventory_valuation_method | item.inventory_valuation_method |
| is_receivable | item.is_receivable |
| product_tax_category | item.product_tax_category |
| sales_margin | item.sales_margin |
| can_be_sold | item.can_be_sold |
| can_be_purchased | item.can_be_purchased |
| track_inventory | item.track_inventory |
| item_type | item.item_type |
| additional_preferences | item.additional_preferences |
| is_project_associated | item.is_project_associated |
| project_id | item.project_id |
Set Item Details
Updates or sets data within the current context. This method allows your widget to modify field values, update state, or pass data back to the host application.
- Update field values
- Set widget or module state
- Pass data to the parent application
window.onload = function () {
ZFAPPS.extension.init().then(function(App) {
ZFAPPS.set('item.name', <value>).then(function (data) {
//response Handling
}).catch(function (err) {
//error Handling
});
});
}
| Property | Request |
|---|---|
| attribute_name1 | item.attribute_name1 |
| attribute_name2 | item.attribute_name2 |
| attribute_name3 | item.attribute_name3 |
| attribute_option_name1 | item.attribute_option_name1 |
| attribute_option_name2 | item.attribute_option_name2 |
| attribute_option_name3 | item.attribute_option_name3 |
| name | item.name |
| description | item.description |
| rate | item.rate |
| account_id | item.account_id |
Show More Supported Input Keys
| Property | Request |
|---|---|
| item_id | item.item_id |
| tax_id | item.tax_id |
| purchase_tax_id | item.purchase_tax_id |
| tags | item.tags |
| sku | item.sku |
| upc | item.upc |
| ean | item.ean |
| part_number | item.part_number |
| isbn | item.isbn |
| custom_fields | item.custom_fields |
| purchase_rate | item.purchase_rate |
| purchase_account_id | item.purchase_account_id |
| purchase_description | item.purchase_description |
| group_id | item.group_id |
| purchase_tax_rule_id | item.purchase_tax_rule_id |
| sales_tax_rule_id | item.sales_tax_rule_id |
| is_taxable | item.is_taxable |
| tax_exemption_code | item.tax_exemption_code |
| product_type | item.product_type |
| reorder_level | item.reorder_level |
| preferred_vendors | item.preferred_vendors |
| vendor_id | item.vendor_id |
| inventory_account_id | item.inventory_account_id |
| avatax_tax_code | item.avatax_tax_code |
| initial_stock | item.initial_stock |
| initial_stock_rate | item.initial_stock_rate |
| crm_owner_id | item.crm_owner_id |
| hsn_or_sac | item.hsn_or_sac |
| item_tax_preferences | item.item_tax_preferences |
| track_serial_number | item.track_serial_number |
| serial_numbers | item.serial_numbers |
| track_batch_number | item.track_batch_number |
| batches | item.batches |
| brand | item.brand |
| manufacturer | item.manufacturer |
| is_returnable | item.is_returnable |
| category_id | item.category_id |
| package_details | item.package_details |
| warehouses | item.warehouses |
| locations | item.locations |
| unit | item.unit |
| unit_id | item.unit_id |
| default_sales_unit_conversion_id | item.default_sales_unit_conversion_id |
| default_purchase_unit_conversion_id | item.default_purchase_unit_conversion_id |
| revenue_recognition_rule_id | item.revenue_recognition_rule_id |
| recognition_type | item.recognition_type |
| revenue_recognition_deferred_account_id | item.revenue_recognition_deferred_account_id |
| label_rate | item.label_rate |
| name_sec_lang | item.name_sec_lang |
| alias_name | item.alias_name |
| sat_item_key_code | item.sat_item_key_code |
| unitkey_code | item.unitkey_code |
| taxability_type | item.taxability_type |
| show_item_in_portal | item.show_item_in_portal |
| classes | item.classes |
| min_profit_percent | item.min_profit_percent |
| integration_references | item.integration_references |
| allowed_qty_customer | item.allowed_qty_customer |
| allowed_qty_salesperson | item.allowed_qty_salesperson |
| qty_frequency_customer | item.qty_frequency_customer |
| qty_frequency_salesperson | item.qty_frequency_salesperson |
| is_storage_location_enabled | item.is_storage_location_enabled |
| item_classification_code | item.item_classification_code |
| origin_country_code | item.origin_country_code |
| package_unit_code | item.package_unit_code |
| einvoice_import_id | item.einvoice_import_id |
| inventory_valuation_method | item.inventory_valuation_method |
| is_receivable | item.is_receivable |
| product_tax_category | item.product_tax_category |
| sales_margin | item.sales_margin |
| can_be_sold | item.can_be_sold |
| can_be_purchased | item.can_be_purchased |
| track_inventory | item.track_inventory |
| item_type | item.item_type |
| additional_preferences | item.additional_preferences |
| is_project_associated | item.is_project_associated |
| project_id | item.project_id |
Get Items List
Retrieves multiple data points or a collection of records related to the current context. This method is useful for fetching lists, related records, or bulk data required for your widget's functionality.
- Fetch related records
- Retrieve collections of data
- Access lists or tables of information
window.onload = function () {
ZFAPPS.extension.init().then(function(App) {
ZFAPPS.get('items').then(function (data) {
//response Handling
}).catch(function (err) {
//error Handling
});
});
}
| Property | Request |
|---|---|
| account_id | item.account_id |
| account_name | item.account_name |
| actual_available_stock | item.actual_available_stock |
| actual_available_stock_formatted | item.actual_available_stock_formatted |
| available_stock | item.available_stock |
| available_stock_formatted | item.available_stock_formatted |
| brand | item.brand |
| can_be_purchased | item.can_be_purchased |
| can_be_sold | item.can_be_sold |
| created_time | item.created_time |
Show More Supported Input Keys
| Property | Request |
|---|---|
| description | item.description |
| dimension_unit | item.dimension_unit |
| dimensions_with_unit | item.dimensions_with_unit |
| ean | item.ean |
| ean_formatted | item.ean_formatted |
| has_attachment | item.has_attachment |
| height | item.height |
| image_document_id | item.image_document_id |
| image_name | item.image_name |
| image_type | item.image_type |
| is_combo_product | item.is_combo_product |
| is_linked_with_zohocrm | item.is_linked_with_zohocrm |
| is_returnable | item.is_returnable |
| isbn | item.isbn |
| item_id | item.item_id |
| item_name | item.item_name |
| item_type | item.item_type |
| item_type_formatted | item.item_type_formatted |
| last_modified_time | item.last_modified_time |
| length | item.length |
| manufacturer | item.manufacturer |
| name | item.name |
| part_number | item.part_number |
| product_type | item.product_type |
| product_type_formatted | item.product_type_formatted |
| purchase_account_id | item.purchase_account_id |
| purchase_account_name | item.purchase_account_name |
| purchase_description | item.purchase_description |
| purchase_rate | item.purchase_rate |
| purchase_rate_formatted | item.purchase_rate_formatted |
| rate | item.rate |
| rate_formatted | item.rate_formatted |
| reorder_level | item.reorder_level |
| reorder_level_formatted | item.reorder_level_formatted |
| show_in_storefront | item.show_in_storefront |
| sku | item.sku |
| source | item.source |
| source_formatted | item.source_formatted |
| status | item.status |
| stock_on_hand | item.stock_on_hand |
| stock_on_hand_formatted | item.stock_on_hand_formatted |
| tags | item.tags |
| tax_id | item.tax_id |
| tax_name | item.tax_name |
| tax_percentage | item.tax_percentage |
| track_batch_number | item.track_batch_number |
| track_inventory | item.track_inventory |
| track_serial_number | item.track_serial_number |
| unit | item.unit |
| upc | item.upc |
| upc_formatted | item.upc_formatted |
| weight | item.weight |
| weight_unit | item.weight_unit |
| weight_with_unit | item.weight_with_unit |
| width | item.width |
| zcrm_product_id | item.zcrm_product_id |
Set Item customfields
Specifically designed to update custom field values within the current context. This method allows your widget to target and modify custom fields without affecting standard fields, ensuring precise data management.
- Update custom field values
- Manage user-defined data points
- Ensure targeted updates to specific fields
window.onload = function () {
ZFAPPS.extension.init().then(function(App) {
ZFAPPS.set('item.<custom_field_api_name>',<value>).then(function (data) {
//response Handling
}).catch(function (err) {
//error Handling
});
});
}
Events
ON_ITEM_PAGE_LOAD
This event is triggered when the widget is loaded for the first time on the item page. You can use this event to initialize data, fetch required resources, or set up the initial state of your widget.
ZFAPPS.extension.init().then(function(App) {
App.instance.on('ON_ITEM_PAGE_LOAD').then(async function() {
// Set default value for a custom field
await ZFAPPS.set('item.cf_priority_level', 'Normal');
ZFAPPS.invoke('SHOW_NOTIFICATION', {
type: 'success',
message: 'Default priority level has been set to Normal.'
});
}).catch(function(err) {
console.error('Error:', err);
});
});
ON_ITEM_CHANGE
This event is triggered whenever a supported field value is changed within the item form. The event is fired based on the configured supported keys, allowing your widget to react dynamically to user input.
ZFAPPS.extension.init().then(function(App) {
App.instance.on('ON_ITEM_CHANGE').then(async function() {
var record = await ZFAPPS.get('item');
record = record?.['custom_fields'];
if (record.cf_special_flag) {
ZFAPPS.invoke('SHOW_NOTIFICATION', {
type: 'success',
message: 'Special option selected. Please review additional details before saving.'
});
}
}).catch(function(err) {
console.error('Error:', err);
});
});
ON_ITEM_PRE_SAVE
This event is triggered just before the item record is saved in your organization. It allows your widget to validate data, modify field values, or perform custom checks before the save operation is completed.
ZFAPPS.extension.init().then(function(App) {
App.instance.on('ON_ITEM_PRE_SAVE').then(async function() {
var record = await ZFAPPS.get('item');
record = record?.['custom_fields'];
if (record.cf_approval_required && !record.cf_approval_notes) {
await ZFAPPS.invoke('SHOW_NOTIFICATION', {
type: 'error',
message: 'Approval notes are required when Approval Required is selected.'
});
return {
prevent_save: true
};
}
}).catch(function(err) {
console.error('Error:', err);
});
});
ON_ITEM_PREVIEW
This event is triggered when the preview of a item record is opened in your organization. It allows your widget to access record data and render contextual information during the preview phase.
ZFAPPS.extension.init().then(function(App) {
App.instance.on('ON_ITEM_PREVIEW').then(async function() {
var record = await ZFAPPS.get('item');
record = record?.['custom_fields'];
if (record.cf_priority_level === 'High') {
ZFAPPS.invoke('SHOW_NOTIFICATION', {
type: 'error',
message: 'This record is marked as High Priority.'
});
}
}).catch(function(err) {
console.error('Error:', err);
});
});
ITEM_SAVED
This event is triggered after the item record is successfully saved in your organization. You can use this event to perform post-save actions such as syncing data, triggering notifications, or updating external systems.
ZFAPPS.extension.init().then(function(App) {
App.instance.on('ON_ITEM_SAVED').then(function(data) {
var recordId = data && data.record_id;
ZFAPPS.invoke('SHOW_NOTIFICATION', {
type: 'success',
message: 'Record saved successfully. Record ID: ' + recordId
});
console.log('Saved record ID:', recordId);
}).catch(function(err) {
console.error('Error:', err);
});
});