Examples of Status Actions
Status actions are triggered when the
status of a shipment or a trip changes. Generally they send an
email, call an (external)
URL or change or add something to a shipment or a trip (like the time something happened). For a full explanation look here:
Status codes and Actions.
See also:
Examples of URL Status Actions
Page content:
Introduction to database fields and modifiers
When defining actions we often use
data from a shipment or a trip. As shown in the examples below database
Field Names must be defined between curly brackets {}.
There are a few
modifiers that can be added to alter the content of these database fields, which we explain here:
- substring
- md5
- sha1
- b64
- preg_match
- preg_replace
- xlat
- xlat param
- today
substring
Description : insert part of a string
Notation : {FIELD,start[,length}
Examples : {pickupCity,0,5} {lastStatus,-5} {deliveryDay,0,2} {deliveryYear,4,2}
substring(2)
Description : insert part of a string
Notation : {substr(start[,length]):FIELD}
Examples : {substr(0,5):pickupCity} {substr(17):lastStatus}
md5
Description : md5 encryption
Notation : {md5:FIELD}
Examples : {md5:userID} {md5:customerBankAccount}
sha1
Description : sha1 encryption
Notation : {sha1:FIELD}
Examples : {sha1:userEmail} {sha1:userPasswd}
b64
Description : base64 encoded
Notation : {b64:FIELD}
Examples : {b64:remarks} {b64:podDocument}
preg_match
Description : catch part of a string matching a certain regular expression pattern
Notation : {FIELD:preg_match/pattern/}
Examples :
{deliveryAddress:preg_match/.*(\d+)$/U} (catch house number)
{status:preg_match/.*\((\d+)/} (extracts 23960 from string "2012-08-21 09:28 LOSGEWICHT GEWIJZIGD (23960 lostijd 07:30-09:30)")
preg_replace
Description : replace part of a string matching a certain regular expression pattern
Notation : {FIELD:preg_replace/pattern/}
Examples :
{status:preg_replace/(pick-up|delivery)\sok/$1 went well/}
xlat
Description : translate (part of) a value into a new value
Notation : {FIELD:xlat:old=new,old=new,old=new..}
Examples :
{deliveryTerms:xlat:EXW=153,FCA=154,FOB=155,FOA=156,CFR=157}
{pickupCountry:xlat:DE=Deutschland,EN=England,FR=France,BE=Belgium}
{pickupCountry:xlat:"DE"=Deutschland,"EN"=England,"FR"=France,"BE"=Belgium}
It is possible to translate to 'nothing', which can be achieved by leaving out the 'new' value like this:
Notation : {FIELD:xlat:old1=new1,old2=,old3=new3}
In this example, the old2 value will be replaced by nothing (the field gets emptied) whereas the old1 and old3 values will translate in to new1 and new3 respectively.
NOTE1: By using quotes you determine that the matching value must be an exact literal. In other words, the whole value must match (without quotes BEER would be translated into Belgiumlgium in the example of a country code translation):
NOTE2: Translations are case sensitive. So "DE" is not the same as "de.
xlat param
Description : same as xlat but translation values are derived from a param
Notation : {FIELD:xlat:param:countryTranslations}
Example :
{pickupCountry:xlat:param:countryTranslations}
Example for a param named: countryTranslations::
# format:
#oldvalue=newvalue
nl=Nederland
de=Deutschland
fr=France
be=Belgium
NOTE1: You can have multiple params for different customers, and/or a general param with a blank customer number for all others.
today
Description : insert todays date plus or minus a number of days (as yyyy-mm-dd)
Notation : {today[+/-]x[days]}
Examples :
{today+1} (
note: standard; skip weekends)
{today+1days} (
note: do not skip weekends)
{substr(8,2):today+1}-{substr(5,2):today+1}-{substr(2,2):today+1} (
note: converted into dd-mm-yy)
Send Track & Trace message (example)
This example sends an email message about a shipment to a customer.
Action example:
Action name : mailReceiver
Action type : Mail
Address : johndoe@receiver.com
Subject : Track & Trace message
Email message :
====================================================================================
S a m p l e S p e d S H I P M E N T A D V I C E N O T I F I C A T I O N
====================================================================================
Phone : 1234-987654321
Fax : 1234-987654321
E-mail : planning@samplesped.com
Our truck {nodeID} will arrive at {pickupDate} to deliver shipment {orderReference}
at {deliveryCity} for customer {deliveryName}
====================================================================================
Quantity: {quantity}
Description: {goodsDesc1}
====================================================================================
Delivery: {deliveryName}
Address: {deliveryAddress}
Postcode: {deliveryPostcode}
City: {deliveryCity}
Country: {deliveryCountry}
====================================================================================
For more information please check: http://samplesped.cargooffice.com
Regards,
NOTE
- You can use HTML tags in you messages for nicer looking messages including images and logos.
Therefore you have to start your message with the html tag and end it with the closing html tag, no characters before or after the html-tags.
Send a CSV or XML file (example)
This example sends an email message with a csv or xml file to a subcontractor.
Please note that the email address has a cc: in this example
Action example:
Action name : mailCsv
Action type : Mail
Address : server@subcon.com cc:backup@gmail.com
Subject : CSV file job assignment
Email message :
{shipmentID};{orderReference};{pickupName};{pickupAddress};{deliveryName};{deliveryAddress};{lastStatus}
Action example:
Action name : mailXml
Action type : Mail
Address : server@subcon.com
Subject : XML file job assignment
Email message :
<job id={shipmentID}>
<reference>{orderReference}</reference>
<pickup>
<name>{pickupName}<ame>
<address>{pickupAddress}</address>
</pickup>
<delivery>
<name>{deliveryName}</name>
<address>{deliveryAddress}</address>
</delivery>
<status>{lastStatus}</status>
</job>
Send an assignment message to a subcontractor (example)
This status action sends an email to a subcontractor with the details of his job.
Typically an action like this is triggered by order status 'assigned'.
Action example:
Action name : mailSubcon
Action type : Mail
Address : johndoe@subcon.com
Subject : job assignment
Email message :
====================================================================================
s a m p l e s p e d
====================================================================================
Phone : 1234-987654321
Fax : 1234-987654321
E-mail : planning@samplesped.com
To : {deliveryNodeID} d.d.: {orderDate}
Pick-up date : {pickupDate}
Pick-up time : {pickupTime} - {pickupTime2}
Pick-up address : {pickupName}
{pickupAddress}
{pickupPostcode} {pickupCity}
{pickupCountry}
Pick-up reference : {orderReference}
pick-up remarks : {pickupRemarks}
====================================================================================
Goods:
{quantitySub1}; {packingSub1}; {goodsID1}; {weightSub1}kg; {lengthSub1} x {widthSub1} x {heightSub1}
{quantitySub2}; {packingSub2}; {goodsID2}; {weightSub2}kg; {lengthSub2} x {widthSub2} x {heightSub2}
{quantitySub3}; {packingSub3}; {goodsID3}; {weightSub3}kg; {lengthSub3} x {widthSub3} x {heightSub3}
{quantitySub4}; {packingSub4}; {goodsID4}; {weightSub4}kg; {lengthSub4} x {widthSub4} x {heightSub4}
{quantitySub5}; {packingSub5}; {goodsID5}; {weightSub5}kg; {lengthSub5} x {widthSub5} x {heightSub5}
Total quantity : {quantity}
Total weight : {weight}
====================================================================================
Delivery date : {deliveryDate}
Delivery time : {deliveryTime} - {deliveryTime2}
Delivery address : {deliveryName}
{deliveryAddress}
{deliveryPostcode} {deliveryCity}
{deliveryCountry}
Delivery remarks : {deliveryRemarks}
Please note : {remarks}
====================================================================================
For questions please contact SampleSped Ltd.
Dossier number : {shipmentID}
Customer number : {customerID}
Kind regards,
SampleSped Ltd.
NOTE
- You can use HTML tags in you messages for nicer looking messages including images and logos.
--
WiljoVanLenthe - 2012-08-21
--
HenkRoelofs - 2012-05-09