Methods
Get Bill 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.
Commonly used for :
- Fetch record information
- Read field values
- Access contextual module data
Supported Locations :
bills.creation.sidebarbills.details.sidebar
Sample Code :
window.onload = function () {
ZFAPPS.extension.init().then(function(App) {
ZFAPPS.get('bill').then(function (data) {
}).catch(function (err) {
});
});
}
Supported Input Keys :
| Property | Request |
|---|
| bill_id | bill.bill_id |
| purchaseorder_ids | bill.purchaseorder_ids |
| vendor_id | bill.vendor_id |
| vendor_name | bill.vendor_name |
| source | bill.source |
| can_amend_transaction | bill.can_amend_transaction |
| contact_category | bill.contact_category |
| invoice_conversion_type | bill.invoice_conversion_type |
| unused_credits_payable_amount | bill.unused_credits_payable_amount |
| unused_credits_payable_amount_formatted | bill.unused_credits_payable_amount_formatted |
Show More Supported Input Keys
| Property | Request |
|---|
| status | bill.status |
| status_formatted | bill.status_formatted |
| color_code | bill.color_code |
| current_sub_status_id | bill.current_sub_status_id |
| current_sub_status | bill.current_sub_status |
| current_sub_status_formatted | bill.current_sub_status_formatted |
| sub_statuses | bill.sub_statuses |
| bill_number | bill.bill_number |
| date | bill.date |
| date_formatted | bill.date_formatted |
| is_pre_gst | bill.is_pre_gst |
| due_date | bill.due_date |
| due_date_formatted | bill.due_date_formatted |
| discount_setting | bill.discount_setting |
| tds_calculation_type | bill.tds_calculation_type |
| is_tds_amount_in_percent | bill.is_tds_amount_in_percent |
| tds_percent_formatted | bill.tds_percent_formatted |
| tds_percent | bill.tds_percent |
| tds_amount_formatted | bill.tds_amount_formatted |
| tds_amount | bill.tds_amount |
| tax_account_id | bill.tax_account_id |
| payment_terms | bill.payment_terms |
| payment_terms_label | bill.payment_terms_label |
| payment_expected_date | bill.payment_expected_date |
| payment_expected_date_formatted | bill.payment_expected_date_formatted |
| reference_number | bill.reference_number |
| recurring_bill_id | bill.recurring_bill_id |
| due_by_days | bill.due_by_days |
| due_in_days | bill.due_in_days |
| due_days | bill.due_days |
| currency_id | bill.currency_id |
| currency_code | bill.currency_code |
| currency_symbol | bill.currency_symbol |
| currency_name_formatted | bill.currency_name_formatted |
| documents | bill.documents |
| subject_content | bill.subject_content |
| price_precision | bill.price_precision |
| exchange_rate | bill.exchange_rate |
| custom_fields | bill.custom_fields |
| custom_field_hash | bill.custom_field_hash |
| is_viewed_by_client | bill.is_viewed_by_client |
| client_viewed_time | bill.client_viewed_time |
| client_viewed_time_formatted | bill.client_viewed_time_formatted |
| is_tds_applied | bill.is_tds_applied |
| is_item_level_tax_calc | bill.is_item_level_tax_calc |
| is_inclusive_tax | bill.is_inclusive_tax |
| tax_rounding | bill.tax_rounding |
| is_uber_bill | bill.is_uber_bill |
| is_tally_bill | bill.is_tally_bill |
| mark_as_received_status | bill.mark_as_received_status |
| is_standalone_bill | bill.is_standalone_bill |
| track_discount_in_account | bill.track_discount_in_account |
| line_items | bill.line_items |
| submitted_date | bill.submitted_date |
| submitted_date_formatted | bill.submitted_date_formatted |
| submitted_by | bill.submitted_by |
| submitted_by_name | bill.submitted_by_name |
| submitted_by_email | bill.submitted_by_email |
| submitted_by_photo_url | bill.submitted_by_photo_url |
| submitter_id | bill.submitter_id |
| approver_id | bill.approver_id |
| adjustment | bill.adjustment |
| adjustment_formatted | bill.adjustment_formatted |
| adjustment_description | bill.adjustment_description |
| discount_amount_formatted | bill.discount_amount_formatted |
| discount_amount | bill.discount_amount |
| discount | bill.discount |
| discount_applied_on_amount_formatted | bill.discount_applied_on_amount_formatted |
| discount_applied_on_amount | bill.discount_applied_on_amount |
| is_discount_before_tax | bill.is_discount_before_tax |
| discount_account_id | bill.discount_account_id |
| discount_account_name | bill.discount_account_name |
| discount_type | bill.discount_type |
| sub_total | bill.sub_total |
| sub_total_formatted | bill.sub_total_formatted |
| sub_total_inclusive_of_tax | bill.sub_total_inclusive_of_tax |
| sub_total_inclusive_of_tax_formatted | bill.sub_total_inclusive_of_tax_formatted |
| tax_total | bill.tax_total |
| tax_total_formatted | bill.tax_total_formatted |
| total | bill.total |
| total_formatted | bill.total_formatted |
| payment_made | bill.payment_made |
| payment_made_formatted | bill.payment_made_formatted |
| vendor_credits_applied | bill.vendor_credits_applied |
| vendor_credits_applied_formatted | bill.vendor_credits_applied_formatted |
| is_line_item_invoiced | bill.is_line_item_invoiced |
| purchaseorders | bill.purchaseorders |
| taxes | bill.taxes |
| tds_override_preference | bill.tds_override_preference |
| tds_summary | bill.tds_summary |
| balance | bill.balance |
| balance_formatted | bill.balance_formatted |
| billing_address | bill.billing_address |
| is_portal_enabled | bill.is_portal_enabled |
| payments | bill.payments |
| vendor_credits | bill.vendor_credits |
| journal_credits | bill.journal_credits |
| comments | bill.comments |
| created_time | bill.created_time |
| created_by_id | bill.created_by_id |
| last_modified_id | bill.last_modified_id |
| last_modified_time | bill.last_modified_time |
| warn_create_vendor_credits | bill.warn_create_vendor_credits |
| reference_id | bill.reference_id |
| notes | bill.notes |
| terms | bill.terms |
| attachment_name | bill.attachment_name |
| open_purchaseorders_count | bill.open_purchaseorders_count |
| un_billed_items | bill.un_billed_items |
| template_id | bill.template_id |
| template_name | bill.template_name |
| page_width | bill.page_width |
| page_height | bill.page_height |
| orientation | bill.orientation |
| template_type | bill.template_type |
| template_type_formatted | bill.template_type_formatted |
| invoices | bill.invoices |
| is_approval_required | bill.is_approval_required |
| allocated_landed_costs | bill.allocated_landed_costs |
| entity_type | bill.entity_type |
| credit_notes | bill.credit_notes |
| reference_bill_id | bill.reference_bill_id |
| can_send_in_mail | bill.can_send_in_mail |
| approvers_list | bill.approvers_list |
Set Bill 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.
Commonly used for :
- Update field values
- Set widget or module state
- Pass data to the parent application
Supported Locations :
bills.creation.sidebar
Sample Code :
window.onload = function () {
ZFAPPS.extension.init().then(function(App) {
ZFAPPS.set('bill.name', <value>).then(function (data) {
}).catch(function (err) {
});
});
}
Supported Input Keys :
| Property | Request |
|---|
| bill_id | bill.bill_id |
| purchaseorder_ids | bill.purchaseorder_ids |
| vendor_id | bill.vendor_id |
| vendor_name | bill.vendor_name |
| source | bill.source |
| can_amend_transaction | bill.can_amend_transaction |
| contact_category | bill.contact_category |
| invoice_conversion_type | bill.invoice_conversion_type |
| unused_credits_payable_amount | bill.unused_credits_payable_amount |
| unused_credits_payable_amount_formatted | bill.unused_credits_payable_amount_formatted |
Show More Supported Input Keys
| Property | Request |
|---|
| status | bill.status |
| status_formatted | bill.status_formatted |
| color_code | bill.color_code |
| current_sub_status_id | bill.current_sub_status_id |
| current_sub_status | bill.current_sub_status |
| current_sub_status_formatted | bill.current_sub_status_formatted |
| sub_statuses | bill.sub_statuses |
| bill_number | bill.bill_number |
| date | bill.date |
| date_formatted | bill.date_formatted |
| is_pre_gst | bill.is_pre_gst |
| due_date | bill.due_date |
| due_date_formatted | bill.due_date_formatted |
| discount_setting | bill.discount_setting |
| tds_calculation_type | bill.tds_calculation_type |
| is_tds_amount_in_percent | bill.is_tds_amount_in_percent |
| tds_percent_formatted | bill.tds_percent_formatted |
| tds_percent | bill.tds_percent |
| tds_amount_formatted | bill.tds_amount_formatted |
| tds_amount | bill.tds_amount |
| tax_account_id | bill.tax_account_id |
| payment_terms | bill.payment_terms |
| payment_terms_label | bill.payment_terms_label |
| payment_expected_date | bill.payment_expected_date |
| payment_expected_date_formatted | bill.payment_expected_date_formatted |
| reference_number | bill.reference_number |
| recurring_bill_id | bill.recurring_bill_id |
| due_by_days | bill.due_by_days |
| due_in_days | bill.due_in_days |
| due_days | bill.due_days |
| currency_id | bill.currency_id |
| currency_code | bill.currency_code |
| currency_symbol | bill.currency_symbol |
| currency_name_formatted | bill.currency_name_formatted |
| documents | bill.documents |
| subject_content | bill.subject_content |
| price_precision | bill.price_precision |
| exchange_rate | bill.exchange_rate |
| custom_fields | bill.custom_fields |
| custom_field_hash | bill.custom_field_hash |
| is_viewed_by_client | bill.is_viewed_by_client |
| client_viewed_time | bill.client_viewed_time |
| client_viewed_time_formatted | bill.client_viewed_time_formatted |
| is_tds_applied | bill.is_tds_applied |
| is_item_level_tax_calc | bill.is_item_level_tax_calc |
| is_inclusive_tax | bill.is_inclusive_tax |
| tax_rounding | bill.tax_rounding |
| is_uber_bill | bill.is_uber_bill |
| is_tally_bill | bill.is_tally_bill |
| mark_as_received_status | bill.mark_as_received_status |
| is_standalone_bill | bill.is_standalone_bill |
| track_discount_in_account | bill.track_discount_in_account |
| line_items | bill.line_items |
| submitted_date | bill.submitted_date |
| submitted_date_formatted | bill.submitted_date_formatted |
| submitted_by | bill.submitted_by |
| submitted_by_name | bill.submitted_by_name |
| submitted_by_email | bill.submitted_by_email |
| submitted_by_photo_url | bill.submitted_by_photo_url |
| submitter_id | bill.submitter_id |
| approver_id | bill.approver_id |
| adjustment | bill.adjustment |
| adjustment_formatted | bill.adjustment_formatted |
| adjustment_description | bill.adjustment_description |
| discount_amount_formatted | bill.discount_amount_formatted |
| discount_amount | bill.discount_amount |
| discount | bill.discount |
| discount_applied_on_amount_formatted | bill.discount_applied_on_amount_formatted |
| discount_applied_on_amount | bill.discount_applied_on_amount |
| is_discount_before_tax | bill.is_discount_before_tax |
| discount_account_id | bill.discount_account_id |
| discount_account_name | bill.discount_account_name |
| discount_type | bill.discount_type |
| sub_total | bill.sub_total |
| sub_total_formatted | bill.sub_total_formatted |
| sub_total_inclusive_of_tax | bill.sub_total_inclusive_of_tax |
| sub_total_inclusive_of_tax_formatted | bill.sub_total_inclusive_of_tax_formatted |
| tax_total | bill.tax_total |
| tax_total_formatted | bill.tax_total_formatted |
| total | bill.total |
| total_formatted | bill.total_formatted |
| payment_made | bill.payment_made |
| payment_made_formatted | bill.payment_made_formatted |
| vendor_credits_applied | bill.vendor_credits_applied |
| vendor_credits_applied_formatted | bill.vendor_credits_applied_formatted |
| is_line_item_invoiced | bill.is_line_item_invoiced |
| purchaseorders | bill.purchaseorders |
| taxes | bill.taxes |
| tds_override_preference | bill.tds_override_preference |
| tds_summary | bill.tds_summary |
| balance | bill.balance |
| balance_formatted | bill.balance_formatted |
| billing_address | bill.billing_address |
| is_portal_enabled | bill.is_portal_enabled |
| payments | bill.payments |
| vendor_credits | bill.vendor_credits |
| journal_credits | bill.journal_credits |
| comments | bill.comments |
| created_time | bill.created_time |
| created_by_id | bill.created_by_id |
| last_modified_id | bill.last_modified_id |
| last_modified_time | bill.last_modified_time |
| warn_create_vendor_credits | bill.warn_create_vendor_credits |
| reference_id | bill.reference_id |
| notes | bill.notes |
| terms | bill.terms |
| attachment_name | bill.attachment_name |
| open_purchaseorders_count | bill.open_purchaseorders_count |
| un_billed_items | bill.un_billed_items |
| template_id | bill.template_id |
| template_name | bill.template_name |
| page_width | bill.page_width |
| page_height | bill.page_height |
| orientation | bill.orientation |
| template_type | bill.template_type |
| template_type_formatted | bill.template_type_formatted |
| invoices | bill.invoices |
| is_approval_required | bill.is_approval_required |
| allocated_landed_costs | bill.allocated_landed_costs |
| entity_type | bill.entity_type |
| credit_notes | bill.credit_notes |
| reference_bill_id | bill.reference_bill_id |
| can_send_in_mail | bill.can_send_in_mail |
| approvers_list | bill.approvers_list |
Set Bill 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.
Commonly used for :
- Update custom field values
- Manage user-defined data points
- Ensure targeted updates to specific fields
Supported Locations :
bills.creation.sidebar
Sample Code :
window.onload = function () {
ZFAPPS.extension.init().then(function(App) {
ZFAPPS.set('bill.<custom_field_api_name>',<value>).then(function (data) {
}).catch(function (err) {
});
});
}
Get Line Items
This method allows you to retrieve the line items associated with the current bill. It can be used to fetch details such as product information, quantity, rate, and total for each line item. This is particularly useful when you want to display or utilize the bills's line item details within your widget or extension.
Supported Locations :
bills.creation.sidebar
Sample Code :
window.onload = function () {
ZFAPPS.extension.init().then(function(App) {
ZFAPPS.get('bill.line_items').then(function (res) {
console.log('bill line items : ', res);
}).catch(function (err) {
console.log('Error while fetching bill line items : ', err);
});
});
}
Supported Input Keys :
| Property | Request |
|---|
| line_item_id | line_item_id |
| purchaseorder_item_id | purchaseorder_item_id |
| receive_item_id | receive_item_id |
| item_order | item_order |
| item_id | item_id |
| account_id | account_id |
| item_custom_fields | item_custom_fields |
| description | description |
| rate | rate |
| quantity | quantity |
Show More Supported Input Keys
| Property | Request |
|---|
| discount | discount |
| discounts | discounts |
| discount_account_id | discount_account_id |
| tax_id | tax_id |
| tax_exemption_code | tax_exemption_code |
| tax_exemption_id | tax_exemption_id |
| name | name |
| product_type | product_type |
| acquisition_tax_id | acquisition_tax_id |
| reverse_charge_tax_id | reverse_charge_tax_id |
| tags | tags |
| customer_id | customer_id |
| is_billable | is_billable |
| project_id | project_id |
| hsn_or_sac | hsn_or_sac |
| warehouse_id | warehouse_id |
| location_id | location_id |
| itc_eligibility | itc_eligibility |
| serial_numbers | serial_numbers |
| batches | batches |
| gst_treatment_code | gst_treatment_code |
| tax_treatment | tax_treatment |
| is_landedcost | is_landedcost |
| tax_treatment_code | tax_treatment_code |
| pricebook_id | pricebook_id |
| markup_percent | markup_percent |
| tds_tax_id | tds_tax_id |
| purchase_request_items | purchase_request_items |
| unit | unit |
| unit_conversion_id | unit_conversion_id |
| taxes | taxes |
| batch_price_details | batch_price_details |
| storages | storages |
| item_matching_type | item_matching_type |
| indirect_tds_tax_id | indirect_tds_tax_id |
| sales_rate | sales_rate |
| label_rate | label_rate |
| product_tax_category | product_tax_category |
| tax_selection_mode | tax_selection_mode |
| receive_line_items | receive_line_items |
| line_item_taxes | line_item_taxes |
| line_item_tds | line_item_tds |
| purchase_return_item_id | purchase_return_item_id |
| bill_item_id | bill_item_id |
Set Line Items
This methods is to allowed for set a list of line items in the current bill. It can be used to set details such as product information, quantity, rate, and total for multiple line items. This is particularly useful when you want to update or set multiple line items details within your widget or extension.This methods is append the line items to the existing line items in the bill.
Supported Locations :
bills.creation.sidebar
Sample Code :
window.onload = function () {
ZFAPPS.extension.init().then(function(App) {
var lineItemMetaData =[{'rate':'1000','description':'Table','name':'Table'},{'rate':'1000','description':'Monitor','name':'Monitor'}]
ZFAPPS.set('bill.line_items',lineItemMetaData).then(function (res) {
console.log('bill line items : ', res);
}).catch(function (err) {
console.log('Error while fetching bill line items : ', err);
});
});
}
Supported Input Keys :
| Property | Request |
|---|
| line_item_id | line_item_id |
| purchaseorder_item_id | purchaseorder_item_id |
| receive_item_id | receive_item_id |
| item_order | item_order |
| item_id | item_id |
| account_id | account_id |
| item_custom_fields | item_custom_fields |
| description | description |
| rate | rate |
| quantity | quantity |
Show More Supported Input Keys
| Property | Request |
|---|
| discount | discount |
| discounts | discounts |
| discount_account_id | discount_account_id |
| tax_id | tax_id |
| tax_exemption_code | tax_exemption_code |
| tax_exemption_id | tax_exemption_id |
| name | name |
| product_type | product_type |
| acquisition_tax_id | acquisition_tax_id |
| reverse_charge_tax_id | reverse_charge_tax_id |
| tags | tags |
| customer_id | customer_id |
| is_billable | is_billable |
| project_id | project_id |
| hsn_or_sac | hsn_or_sac |
| warehouse_id | warehouse_id |
| location_id | location_id |
| itc_eligibility | itc_eligibility |
| serial_numbers | serial_numbers |
| batches | batches |
| gst_treatment_code | gst_treatment_code |
| tax_treatment | tax_treatment |
| is_landedcost | is_landedcost |
| tax_treatment_code | tax_treatment_code |
| pricebook_id | pricebook_id |
| markup_percent | markup_percent |
| tds_tax_id | tds_tax_id |
| purchase_request_items | purchase_request_items |
| unit | unit |
| unit_conversion_id | unit_conversion_id |
| taxes | taxes |
| batch_price_details | batch_price_details |
| storages | storages |
| item_matching_type | item_matching_type |
| indirect_tds_tax_id | indirect_tds_tax_id |
| sales_rate | sales_rate |
| label_rate | label_rate |
| product_tax_category | product_tax_category |
| tax_selection_mode | tax_selection_mode |
| receive_line_items | receive_line_items |
| line_item_taxes | line_item_taxes |
| line_item_tds | line_item_tds |
| purchase_return_item_id | purchase_return_item_id |
| bill_item_id | bill_item_id |
Set Single Line Items
This methods is to allowed for setting/updating a single line item in the current bill. It can be used to set details such as product information, quantity, rate, and total for a single line item. This is particularly useful when you want to update or set a single line item details within your widget or extension.
Supported Locations :
bills.creation.sidebar
Sample Code :
window.onload = function () {
ZFAPPS.extension.init().then(function(App) {
ZFAPPS.set('bill.line_items[0]',{'rate':'1000'}).then(function (res) {
console.log('bill line item rate : ', res);
}).catch(function (err) {
console.log('Error while fetching bill line item rate : ', err);
});
});
}
Supported Input Keys :
| Property | Request |
|---|
| line_item_id | line_item_id |
| purchaseorder_item_id | purchaseorder_item_id |
| receive_item_id | receive_item_id |
| item_order | item_order |
| item_id | item_id |
| account_id | account_id |
| item_custom_fields | item_custom_fields |
| description | description |
| rate | rate |
| quantity | quantity |
Show More Supported Input Keys
| Property | Request |
|---|
| discount | discount |
| discounts | discounts |
| discount_account_id | discount_account_id |
| tax_id | tax_id |
| tax_exemption_code | tax_exemption_code |
| tax_exemption_id | tax_exemption_id |
| name | name |
| product_type | product_type |
| acquisition_tax_id | acquisition_tax_id |
| reverse_charge_tax_id | reverse_charge_tax_id |
| tags | tags |
| customer_id | customer_id |
| is_billable | is_billable |
| project_id | project_id |
| hsn_or_sac | hsn_or_sac |
| warehouse_id | warehouse_id |
| location_id | location_id |
| itc_eligibility | itc_eligibility |
| serial_numbers | serial_numbers |
| batches | batches |
| gst_treatment_code | gst_treatment_code |
| tax_treatment | tax_treatment |
| is_landedcost | is_landedcost |
| tax_treatment_code | tax_treatment_code |
| pricebook_id | pricebook_id |
| markup_percent | markup_percent |
| tds_tax_id | tds_tax_id |
| purchase_request_items | purchase_request_items |
| unit | unit |
| unit_conversion_id | unit_conversion_id |
| taxes | taxes |
| batch_price_details | batch_price_details |
| storages | storages |
| item_matching_type | item_matching_type |
| indirect_tds_tax_id | indirect_tds_tax_id |
| sales_rate | sales_rate |
| label_rate | label_rate |
| product_tax_category | product_tax_category |
| tax_selection_mode | tax_selection_mode |
| receive_line_items | receive_line_items |
| line_item_taxes | line_item_taxes |
| line_item_tds | line_item_tds |
| purchase_return_item_id | purchase_return_item_id |
| bill_item_id | bill_item_id |
Set Bulk Line Items
This methods is to allowed for replacing/updating all the existing line items in the current bill. It can be used to set details such as product information, quantity, rate, and total for multiple line items. This is particularly useful when you want to update or set multiple line items details within your widget or extension.
Supported Locations :
bills.creation.sidebar
Sample Code :
window.onload = function () {
ZFAPPS.extension.init().then(function(App) {
var lineItemMetaData =[{'rate':'1000','description':'Table','name':'Table'},{'rate':'1000','description':'Monitor','name':'Monitor'}]
ZFAPPS.set('bill.line_items.bulk_update',lineItemMetaData).then(function (res) {
console.log('bill line items : ', res);
}).catch(function (err) {
console.log('Error while fetching bill line items : ', err);
});
});
}
Supported Input Keys :
| Property | Request |
|---|
| line_item_id | line_item_id |
| purchaseorder_item_id | purchaseorder_item_id |
| receive_item_id | receive_item_id |
| item_order | item_order |
| item_id | item_id |
| account_id | account_id |
| item_custom_fields | item_custom_fields |
| description | description |
| rate | rate |
| quantity | quantity |
Show More Supported Input Keys
| Property | Request |
|---|
| discount | discount |
| discounts | discounts |
| discount_account_id | discount_account_id |
| tax_id | tax_id |
| tax_exemption_code | tax_exemption_code |
| tax_exemption_id | tax_exemption_id |
| name | name |
| product_type | product_type |
| acquisition_tax_id | acquisition_tax_id |
| reverse_charge_tax_id | reverse_charge_tax_id |
| tags | tags |
| customer_id | customer_id |
| is_billable | is_billable |
| project_id | project_id |
| hsn_or_sac | hsn_or_sac |
| warehouse_id | warehouse_id |
| location_id | location_id |
| itc_eligibility | itc_eligibility |
| serial_numbers | serial_numbers |
| batches | batches |
| gst_treatment_code | gst_treatment_code |
| tax_treatment | tax_treatment |
| is_landedcost | is_landedcost |
| tax_treatment_code | tax_treatment_code |
| pricebook_id | pricebook_id |
| markup_percent | markup_percent |
| tds_tax_id | tds_tax_id |
| purchase_request_items | purchase_request_items |
| unit | unit |
| unit_conversion_id | unit_conversion_id |
| taxes | taxes |
| batch_price_details | batch_price_details |
| storages | storages |
| item_matching_type | item_matching_type |
| indirect_tds_tax_id | indirect_tds_tax_id |
| sales_rate | sales_rate |
| label_rate | label_rate |
| product_tax_category | product_tax_category |
| tax_selection_mode | tax_selection_mode |
| receive_line_items | receive_line_items |
| line_item_taxes | line_item_taxes |
| line_item_tds | line_item_tds |
| purchase_return_item_id | purchase_return_item_id |
| bill_item_id | bill_item_id |
Set Line Items Customfields
This method is allowed for setting/updating custom fields for line items in the current bill. It can be used to set details such as product information, quantity, rate, total, and custom field values for multiple line items. This is particularly useful when you want to update or set multiple line items details along with their custom field values within your widget or extension.
Supported Locations :
bills.creation.sidebar
Sample Code :
window.onload = function () {
ZFAPPS.extension.init().then(function(App) {
var lineItemMetaData =[{'rate':'1000','description':'Table','name':'Table','item_custom_fields':[{'api_name':'<line_item_custom_field_name>', 'value':'<value>'}]}]
ZFAPPS.set('bill.line_items',lineItemMetaData).then(function (res) {
console.log('bill line items : ', res);
}).catch(function (err) {
console.log('Error while fetching bill line items : ', err);
});
});
}
Supported Input Keys :
| Property | Request |
|---|
| line_item_id | line_item_id |
| purchaseorder_item_id | purchaseorder_item_id |
| receive_item_id | receive_item_id |
| item_order | item_order |
| item_id | item_id |
| account_id | account_id |
| item_custom_fields | item_custom_fields |
| description | description |
| rate | rate |
| quantity | quantity |
Show More Supported Input Keys
| Property | Request |
|---|
| discount | discount |
| discounts | discounts |
| discount_account_id | discount_account_id |
| tax_id | tax_id |
| tax_exemption_code | tax_exemption_code |
| tax_exemption_id | tax_exemption_id |
| name | name |
| product_type | product_type |
| acquisition_tax_id | acquisition_tax_id |
| reverse_charge_tax_id | reverse_charge_tax_id |
| tags | tags |
| customer_id | customer_id |
| is_billable | is_billable |
| project_id | project_id |
| hsn_or_sac | hsn_or_sac |
| warehouse_id | warehouse_id |
| location_id | location_id |
| itc_eligibility | itc_eligibility |
| serial_numbers | serial_numbers |
| batches | batches |
| gst_treatment_code | gst_treatment_code |
| tax_treatment | tax_treatment |
| is_landedcost | is_landedcost |
| tax_treatment_code | tax_treatment_code |
| pricebook_id | pricebook_id |
| markup_percent | markup_percent |
| tds_tax_id | tds_tax_id |
| purchase_request_items | purchase_request_items |
| unit | unit |
| unit_conversion_id | unit_conversion_id |
| taxes | taxes |
| batch_price_details | batch_price_details |
| storages | storages |
| item_matching_type | item_matching_type |
| indirect_tds_tax_id | indirect_tds_tax_id |
| sales_rate | sales_rate |
| label_rate | label_rate |
| product_tax_category | product_tax_category |
| tax_selection_mode | tax_selection_mode |
| receive_line_items | receive_line_items |
| line_item_taxes | line_item_taxes |
| line_item_tds | line_item_tds |
| purchase_return_item_id | purchase_return_item_id |
| bill_item_id | bill_item_id |
Events
BILL_SAVED
This event is triggered after the bill 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.
Supported Locations :
bills.creation.sidebar
Sample Code :
ZFAPPS.extension.init().then(function(App) {
App.instance.on('ON_BILL_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);
});
});
ON_BILL_CHANGE
This event is triggered whenever there is a change in the bill record while you are creating or editing a bill. It allows your widget to respond to changes in real time, enabling dynamic updates, validations, or calculations based on the modified bill data.
Supported Locations :
bills.creation.sidebar
Sample Code :
ZFAPPS.extension.init().then(function(App) {
App.instance.on('ON_BILL_CHANGE').then(async function() {
try {
var moduleResponse = await ZFAPPS.get('bill');
var moduleName = moduleResponse.module.api_name;
var recordResponse = await ZFAPPS.get('bill');
var record = recordResponse[moduleName];
if (record.vendor_name && record.vendor_name.name === 'ABC Suppliers') {
await ZFAPPS.set(moduleName + '.discount_type', 'entity_level');
await ZFAPPS.set(moduleName + '.discount', '5%');
await ZFAPPS.invoke('SHOW_NOTIFICATION', {
type: 'info',
message: 'A 5% preferred vendor discount has been applied for ABC Suppliers.'
});
}
} catch (error) {
console.error('Error:', error);
}
});
});
ON_BILL_PRE_SAVE
This event is triggered just before the bill 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.
Supported Locations :
bills.creation.sidebar
Sample Code :
ZFAPPS.extension.init().then(function(App) {
App.instance.on('ON_BILL_PRE_SAVE').then(async function() {
var record = await ZFAPPS.get('bill');
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_BILL_PREVIEW
This event is triggered when the preview of a bill record is opened in your organization. It allows your widget to access record data and render contextual information during the preview phase.
Supported Locations :
bills.details.sidebar
Sample Code :
ZFAPPS.extension.init().then(function(App) {
App.instance.on('ON_BILL_PREVIEW').then(async function() {
var record = await ZFAPPS.get('bill');
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);
});
});