PROPOSAL FOR AUTO SHIPPING QUOTE CALCULATION IN THE BUTTON ACTION

Proposal summary

Need to implement a solution for adding the shipping cost to the estimate record. This shipping cost calculation is based upon the following criteria.

  1. Final Destination
  2. Weight
  3. Shipping Term (Inbound)
  4. Total Price (USD)
  5. Slab

We will add a button on the create mode of the Estimate record. On the button click, we will calculate the shipping cost of each item line in the estimate record. This amount will be stored under the respective item in the estimate as an additional shipping item.

Requirement 

Calculate the shipping cost of each item in the quote record. For achieving this requirement, we will add a custom button on the create mode of estimate record. Users need to manually click on the button. On the button click, the auto Shipping Cost Calculation script will work. The calculation is based on the item specific and the script will calculate each item line’s shipping amount and the amount will be stored under the respective item as an Shipping Item in the quote.

Our Solution

Prerequisites

For implementing the Auto Shipping Quote Calculation logic, we will create multiple custom body fields on the quote record and item record.

Transaction body fields in the quote record:

  1. The field for entering the final destination value. This will be a mandatory field. It is a custom body field (type is list/record) and the values populating in the list field is based on the shipping calculation final destination’s list values on excel.
  2. The field for entering Shipping Term (Inbound) value. This will be a mandatory field. It is a custom body field (type is list/record) and the values populating in the list field is based on the shipping calculation list value CIF and FCA on excel.
  3. The field for entering Slab value. This will be a mandatory field. It is a custom body field (type is list/record) and the values populating in the list field is based on the shipping calculation list values in the Slab cell on excel.

Transaction line/column fields in the quote record:

  1. We have created a transaction line field on the item sublist. This will help to source weight value from the corresponding item record.

Body Fields in the item record:

  1. We have created a body field on the item record which will help to enter the unit weight of a specific item. This value will be sourced to item sublist while customers enter the items in the sublist. We will be using this value to calculate the total weight of the item line based on the Estimate record.

We will create Three custom records for storing the slab data and shipping charge data.

  1. The First custom record for storing slab.
  2. The Second custom record for storing inbound shipping charges.
  3. The third custom record for storing outbound shipping charges.

Description of the task 

The requirement can be achieved by deploying multiple scripts

  • User event script for the button on the quote record. 
  • Client script for fetching item lines detail from the estimate record and adding shipping cost item in the item sublist. 
  • Suitelet script for calculating the shipping cost.
  1. We have placed a button in the estimate record named “Auto Shipping Quote Calculation”. This button only shows in create mode of the estimate.
  2. The user will manually click on the button and the client script is triggered to fetch values from the estimate record.
    1. Then the client script passes the data for the suitelet, for calculating the shipping cost.
    2. The suitelet will be fetching details from the custom record, this data will help to process the shipping cost. After processing has completed the response sent back to the client script. 
    3. Using the response data the client script will add items in the quote sublist.
  3. Once the auto shipping calculation is successfully completed, the button is made hidden or disabled.
  4. When a user manually deletes the items from the item sublist, the script logic will automatically remove the corresponding shipping cost item from the sublist. 

The calculation for shipping cost :

  1. Inbound charges 

Fright = for FCA (weight * fright FCA vendors value), for CIF (Fixed amount on  fright CIF vendors value)

BOE = Fixed amount on the corresponding BOE cell.

DUTY = TOTAL PRICE * given percentage in duty/100;

SLAB = TOTAL PRICE * given percentage in cc/100;

  1. Outbound charges 

Fright = weight * fright in slab

Insurance = TOTAL PRICE * given percentage in insurance slab/100;

CC= Fixed amount in custom clearance slab column;

SLAB =  Fixed amount in Coc slab column;

            The weight = quantity * unit weight

            The total price = Total price of each item.

            We consider total shipping cost = inbound total + outbound total.

Assumptions

  1. This script logic works only in the create mode. 
  2. The user will face the performance issue if there are more than 10 items in the quote. 
  3. We recommend the button to be on view mode for better performance and user experience. We will remove the button once the Shipping Cost is added to the line item.
  4. If there is no unit weight value in the item record that item will not be considered for the shipping calculation.
  5. The shipping calculation will not work without values in the fields – final destination value, Shipping Term, and Slab.
  6. Which item is used as a shipping line item?
    If it already exists kindly provide the item number?
    Else kindly create an item for shipping cost purposes.
  7. We will consider only inventory items for shipping cost calculation.

Risks

Users face the performance is to create mode. In create mode, there will be a chance for getting a blank page error or browser hangs for a few minutes on the button click if the sublist has more items. Also, there are some existing customizations.  If the same is to be implemented in the view mode of record, the performance will be better.
So we recommend the button on the view mode.
We can reduce the complexity of the script in view mode.

Leave a comment

Your email address will not be published. Required fields are marked *