Scan, Pack and Ship > Shipment Processing Extension Buttons
  
Shipment Processing Extension Buttons
You can add workflow buttons to the Scan, Pack and Ship screen using the system value key SHIPMENT_EXTN_BUTTON_CONFIG. This system value enables you to initiate workflow tasks from Scan, Pack and Ship. It is expressed through a Java Script Object Notation (JSON) representation of a JavaScript literal object. The administrator takes the following steps:
Configures the workflow tasks that are to be initiated from the Scan, Pack and Ship screen.
Specifies the buttons to display for a shipment using the system value key SHIPMENT_WORKFLOW_{WorkflowCode}, depending on the workflow assigned to the shipment.
A sample configuration of workflow buttons is available for use as a template under SHIPMENT_EXTN_BUTTON_CONFIG. In the sample configuration, ten buttons are added. Each button executes a workflow task using the configured workflow task ID.
[{
"id" : "shExtnBtn1Id",
"iconCls" : "serviceAssignShipmentBtn",
"tooltip" : "Auto Service assignment",
"readOnlyDisable" : "true",
"enableOnShipmentStatus" : ["CREATED"],
"enableStatusList" : ["SEALED", "WEIGHTED"],
"disableOnZeroPackCount" : "true",
"allItemsPacked" : "true",
"taskKeyId" : "BBSRAS50",
"handler" : "function(){performWfTaskButton.call(this);}"
},{
"id" : "shExtnBtn2Id",
"iconCls" : "rateShipmentBtn",
"tooltip" : "Auto Manifest",
"readOnlyDisable" : "true",
"enableOnShipmentStatus" : ["CREATED"],
"enableStatusList" : ["SEALED", "WEIGHTED"],
"disableOnZeroPackCount" : "true",
"allItemsPacked" : "true",
"taskKeyId" : "BBSSHP50",
"handler" : "function(){performWfTaskButton.call(this);}"
},{
"id" : "shExtnBtn3Id",
"iconCls" : "defaultPrinterBtn",
"tooltip" : "Print packing list",
"enableStatusList" : ["SEALED", "WEIGHTED"],
"disableOnZeroPackCount" : "true",
"allItemsPacked" : "true",
"taskKeyId" : "BBSPRTPL50",
"handler" : "function(){performWfTaskButton.call(this);}"
},{
"id" : "shExtnBtn4Id",
"iconCls" : "shipConfirmShipmentBtn",
"tooltip" : "Ship-confirm",
"enableOnShipmentStatus" : ["RATED"],
"taskKeyId" : "DEMOSCCL",
"progress" : "true",
"confirmRun" : "true",
"responseStatus" : {"WARN-364" : {
"id" : "shExtnBtn3Id",
"packStatusList" : ["", "SEALED", "WEIGHTED"],
"prompt" : "true",
"packCountCheck" : "true"},
"WARN-4347" : {
"id" : "shExtnBtn3Id",
"packStatusList" : ["", "SEALED", "WEIGHTED"],
"prompt" : "true",
"packCountCheck" : "true"}
},
"handler" : "function(){performWfTaskButton.call(this);}"
},{
"id" : "shExtnBtn5Id",
"iconCls" : "closeShipmentBtn",
"tooltip" : "Close shipment",
"enableOnShipmentStatus" : ["SHIPPED"],
"taskKeyId" : "BBSCLS50",
"handler" : "function(){performWfTaskButton.call(this);}"
},{
id : 'wfTaskBtnAutoSpacer',
xtype : 'pslspacer',
width : 20
},{
"id" : "shExtnBtnX1Id",
"iconCls" : "shipmentSummaryBtn",
"tooltip" : "Summary",
"taskKeyId" : "WFTSDE50",
"handler" : "function(){performWfTaskButton.call(this);}"
},{
"id" : "shExtnBtnX2Id",
"iconCls" : "shipmentAddressesBtn",
"tooltip" : "Addresses",
"taskKeyId" : "WFTADD50",
"enableReadWriteList" : [""],
"handler" : "function(){performWfTaskButton.call(this);}"
},{
"id" : "shExtnBtnX3Id",
"iconCls" : "rateShopShipmentBtn",
"tooltip" : "Rate Shop",
"readOnlyDisable" : "true",
"enableStatusList" : ["SEALED", "WEIGHTED"],
"disableOnZeroPackCount" : "true",
"allItemsPacked" : "true",
"taskKeyId" : "WFTRAT50",
"handler" : "function(){performWfTaskButton.call(this);}"
},{
"id" : "shExtnBtnX4Id",
"iconCls" : "manifestShipmentBtn",
"tooltip" : "Manifest",
"readOnlyAllowReadWrite" : ["shipmentRated"],
"enableStatusList" : ["SEALED", "WEIGHTED"],
"disableOnZeroPackCount" : "true",
"allItemsPacked" : "true",
"taskKeyId" : "WFTMAN50",
"handler" : "function(){performWfTaskButton.call(this);}"
},{
"id" : "shExtnBtnX5Id",
"iconCls" : "defaultPrintBtn",
"tooltip" : "Re-print Shipment Labels",
"enableStatusList" : ["SEALED", "WEIGHTED"],
"disableOnZeroPackCount" : "true",
"allItemsPacked" : "true",
"taskKeyId" : "BBSPRT50",
"handler" : "function(){performWfTaskButton.call(this);}"
}]
Note: To validate JSON content, go to www.jsonlint.com.
The following table lists the parent object members in the JavaScript literal object and describes how to use each object member when defining an extension button.

Parent Object Members
 
Member
Function
id
Holds the unique ID for the ExtJs component.
iconCls
Specifies the CSS class for the button, which in turn determines the icon used on the button.
tooltip
Provides the button tooltip.
taskKeyId
Holds the ID of the workflow task to be executed.
readOnlyDisable
Specifies if a button is to be displayed when you open a transaction in read-only mode. The possible values are true or false.
enableStatusList
Lists the pack statuses that enable this button. The button is only enabled when every pack on a shipment has a status on this list.
disableOnZeroPackCount
Specifies whether the shipment extension button is disabled when no packs exist on the selected shipment. By default, the shipment extension button is enabled. The possible values are true or false. In the sample configuration, this is set to true for the Rate Shop button, because you cannot rate shop for an empty shipment.
allItemsPacked
Activates a precondition check to determine if all items on the shipment have been packed before the configured workflow task is executed.
confirmRun
Specifies if a pop-up message is displayed, prompting you to confirm that you want to execute the workflow task.
handler
Provides the function that is executed when you click the button.
readOnlyAllowReadWrite
Allows you to execute a shipment-level workflow task in read-write mode when the shipment has been loaded in read-only mode. A shipment can be in read-only mode for different reasons:
shipmentLockIssue - The shipment is locked by another user.
shipmentClosed - The shipment is flagged as closed.
shipmentProtectedAsPerClosed - The shipment is flagged as protected.
shipmentRated - The shipment has been rated.
Where you load a shipment in read-only mode, the workflow task is executed in read-only mode. To allow the task to execute in read-write mode, you add the member readOnlyAllowReadWrite to the workflow task configuration object. The member readOnlyAllowReadWrite is expressed as an array of values and must include all reasons why the shipment was loaded in read-only mode before the workflow task can be executed in read-write mode. In the sample configuration, you can execute the Manifest button when a rated shipment is loaded in read-only mode.
progress
When set to true, indicates that the shipment header workflow task must be executed through a black-box message to the Progress logic. By default, this member is set to false and the task is executed as a Web UI workflow task.
You can configure a Web UI workflow task to initiate a Progress-based workflow task. However, this involves additional setup that you avoid by using the progress member. It also enables handling of error, information, and warning status codes on the browser client by initiating response actions using the member responseStatus.
responseStatus
Lists handler actions for the response codes that can be returned by a black box call to execute a Progress-based workflow task. The handler action is implemented to initiate a button on the Scan, Pack and Ship screen. You configure the handler action using a JavaScript object with the following members:
id determines the ID of the pack- or shipment-level button to be executed.
packStatusList outlines a list of pack statuses. All packs on the transaction must have a status on this list before the transaction level button can be executed.
prompt specifies if a popup message is displayed, asking the user to confirm they want to execute the pack- or shipment-level button.
packCountCheck activates a pre-execution check. This check verifies that the pack count override is equal to the number of packs on the transaction before the pack- or shipment-level task is executed.
enableReadWriteList
Lists the pack statuses for which the button can be executed in read-write mode. Use this condition to further restrict read-write access when:
A shipment is opened in read-write mode.
The member readOnlyAllowReadWrite is configured to allow read-write on a read-only shipment.
When you set enableReadWriteList, the button is executed in read-write mode only when all packs on the shipment have a status on the list. Use enableReadWriteList to force readOnly access to a workflow task. This member appears in the sample configuration under the Addresses button.
enableOnShipmentStatus
Lists the shipment statuses for which a button is enabled. If enableOnShipmentStatus is not included in the button configuration, shipment status is not considered when determining if the button is enabled.
CREATED - Shipment created
RATED - Shipment rated
SHIPPED - Shipment ship-confirmed
CLOSED - Shipment closed