Packages
The Packages module provides access to contextual information about the current package when a widget is rendered within supported inventory-related pages in inventory-enabled organizations. Widgets can retrieve package identifiers and associated item data for use in validations, conditional logic, and UI extensions.
Methods
Get Package 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('package').then(function (data) {
//response Handling
}).catch(function (err) {
//error Handling
});
});
}
| Property | Request |
|---|---|
| package_number | package.package_number |
| date | package.date |
| line_items | package.line_items |
| notes | package.notes |
| custom_fields | package.custom_fields |
| customer_id | package.customer_id |
Set Package 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('package.name', <value>).then(function (data) {
//response Handling
}).catch(function (err) {
//error Handling
});
});
}
| Property | Request |
|---|---|
| package_number | package.package_number |
| date | package.date |
| line_items | package.line_items |
| notes | package.notes |
| custom_fields | package.custom_fields |
| customer_id | package.customer_id |
Set Package 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('package.<custom_field_api_name>',<value>).then(function (data) {
//response Handling
}).catch(function (err) {
//error Handling
});
});
}