Bulk Shipping from a List View
1. Create a new Visualforce page
Name the page something like BulkShipment and add the following code:
<apex:page standardController="Sample_Request__c" extensions="zkmulti.BulkShipmentController" recordSetVar="recordSet"
lightningStylesheets="true" standardStylesheets="false" sidebar="false" applyBodyTag="false" docType="html-5.0">
<script>
var casId = 'a1Cf40000024mv5';
var records = {! recordIds };
console.log('records', records);
if (records.length < 1) {
alert("Please select at least 1 record.");
} else {
var ids = records.join(',');
var url = "{!URLFOR('/apex/zkmulti__BulkShipmentList')}";
if (url.indexOf('?') !== -1) {
url += '&recIds=' + ids;
} else {
url += '?recIds=' + ids;
}
url += '&casId=' + casId;
url += '&type=fast';
url += '&columnFieldSetName=zkmulti__Bulk_UI_Columns';
url += '&isAutoPrint=true';
url += '&scopeSize=20';
if (window.sforce && sforce.one) {
sforce.one.navigateToURL(url, true);
} else {
window.location.replace(url);
}
}
</script>
</apex:page>
Make the following changes to the code:
- Change this line "var casId = 'XXXXXXXXXXXXXXXX'; " to correspond to your Custom Address Source object ID
- Change the standardController=”Case” to the object you are working from e.g. "Order" or "Custom_object__c"
- type - Set this to fast if you don't need to see all columns and just want to ship quickly.
- columnFieldSetName - Before using this you need to set up a field set on your object to display only the columns you want to show. Once that is done you can add the API name here.
- isAutoPrint - Set this to true if you want to automatically print the labels or set it to failse if you want it to suppress automatic printing of labels and instead show the print button.
You can use these optional variables to order the printing by name for example.
- order_field - Order field such as Case number
- order_direction - Order direction
This you can do by updating the URLFOR line.
{!URLFOR('/apex/zkmulti__BulkShipmentList')} to {!URLFOR('/apex/zkmulti__BulkShipmentList', null, [order_field='Name', order_direction='ASC'])}
Create a new list button for the object (e.g. for Case)
Use the same object and page from step 1. Go to Settings > Object Manager > Your Object > Buttons, Links, and Actions and click on New Button or Link
Fill in the information as shown on the screenshot.
Add the new button to Search Layout
Go to Setup > Object Manager > Case > Search Layouts for Salesforce Classic and edit the List View layout.
Select Bulk Void from the Available Buttons and add it to the Selected Buttons column, then save your changes.
Once the button is enabled you can follow our Bulk Ship User Guide on creating bulk shipments.
Bulk Ship from Campaign
You can now bulk ship from the Campaign object in Salesforce. You can set this up with four easy steps.
1. Create Lookups to the Campaign, Lead, and Contact from the Shipment
You can find the steps in our Custom Address Source guide.
2. Custom Address Source
Create a Custom Address Source for the Campaign object. Once you select the lookup the layout will slightly change allowing to add the Lead and Contact lookups.
You can map the recipient address information from the Lead of Contact objects, while any other details related to the shipment can come from the Campaign object.
3. Create a Button
Go to Setup > Customize > Campaigns > Buttons, Links and Actions and create a New Button or Link.
Enter a value for Label and Name, select Detail Page Button as the Display Type, and for the Behaviour choose to Display in existing window without sidebar or header. It should look similar to this:
Next you need to enter the following code, substituting the XXXXXXXXXX with values related to your setup.
{!URLFOR('/apex/zkmulti__BulkShipmentList', Campaign.Id , [id=Campaign.Id,casIdCampaign='XXXXXXXXXX', order_field='XXXXXXXXXX', order_direction='XXXXXXXXXX', filter_status='XXXXXXXXXX', member_status='XXXXXXXXXX'])}
casIdCampaign is the Salesforce Id of your Custom Address Source that you prepared for your Campaign object from Step 1
order_field is the field name you want to label printing to be ordered by. Usually this would be Name
order_direction is either ASC or DESCfilter_status lets you specify a member status to choose to create the shipments for.
filter_status lets you specify a member status to choose to create the shipments for.
member_status lets you specify the member status that should be changed to once the shipment has been created.
Here is a completed button:
From the example above you can see that we are going to create shipments for any campaign member that has the status as "Received", we will set the campaign member to be "Sent" once the shipment is generated, and finally we will Print in ASCending order of Name.
4. Add the Button to the Campaign Layout
Go to Setup > Customize > Campaigns > Page Layouts and edit the layout you want the button to appear on.
Drag the Bulk Ship button on to your page layout and click Save.
You are now ready to Bulk Ship from the campaign object.
Bulk Voiding
From v1.100 and above you can also bulk void shipments. If the Bulk Void button is not available on your Shipments list view, this is how to add it.
Go to Setup > Shipments > Search Layouts for Salesforce Classic.
Edit the List View layout.
Select Bulk Void from the Available Buttons and add it to the Selected Buttons column, then save your changes.
Now if you go back to your Shipments list view you can see the Bulk Void button at the top of the screen.
Once the button is enabled you can follow our Bulk Void User Guide for bulk voiding shipments.