---+!! 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: [[ManualStatuscodes][Status codes and Actions]]. See also: [[StatusActionsUrl][Examples of URL Status Actions]] *Page content:* %TOC% ---++ 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 [[TransportorderFields][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 * preg_match * preg_replace * xlat *substring* <br /> Description : insert part of a string<br /> Notation : {FIELD,start[,length}<br /> Examples : {pickupCity,0,5} {lastStatus,-5} {deliveryDay,0,2} {deliveryYear,4,2}<br /> <br /> *md5* <br /> Description : md5 encryption<br /> Notation : {md5:FIELD}<br /> Examples : {md5:userID} {md5:customerBankAccount}<br /> <br /> *sha1* <br /> Description : sha1 encryption<br /> Notation : {sha1:FIELD}<br /> Examples : {sha1:userEmail} {md5:userPasswd}<br /> <br /> *preg_match* <br /> Description : catch part of a string matching a certain regular expression pattern<br /> Notation : {FIELD:preg_match/pattern/}<br /> Examples :<br /> {deliveryAddress:preg_match/.*(\d+)$/U} (catch house number)<br /> {status:preg_match/.*\((\d+)/} (extracts 23960 from string "2012-08-21 09:28 LOSGEWICHT GEWIJZIGD (23960 lostijd 07:30-09:30)") *preg_replace* <br /> Description : replace part of a string matching a certain regular expression pattern<br /> Notation : {FIELD:preg_replace/pattern/}<br /> Examples :<br /> {status:preg_replace/(pick-up|delivery)\sok/$1 went well/} *xlat* <br /> Description : translate (part of) a value into a new value<br /> Notation : {FIELD:xlat:old=new,old=new,old=new..}<br /> Examples :<br /> {deliveryTerms:xlat:EXW=153,FCA=154,FOB=155,FOA=156,CFR=157}<br /> {pickupCountry:xlat:DE=Deutschland,EN=England,FR=France,BE=Belgium}<br /> {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. NOTE: 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): ---++ Send Track & Trace message (example) This example sends an email message about a shipment to a customer. *Action example:* <verbatim> 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,</verbatim> _NOTE_ * You can use HTML tags in you messages for nicer looking messages including images and logos.<br />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. *Action example:* <verbatim> Action name : mailCsv Action type : Mail Address : server@subcon.com Subject : CSV file job assignment Email message : {shipmentID};{orderReference};{pickupName};{pickupAddress};{deliveryName};{deliveryAddress};{lastStatus}</verbatim> *Action example:* <verbatim> 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> </verbatim> ---++ Send an assignment message to a subcontractor (example) This status action sends an email to a subcontractor with the details of his job.<br /> Typically an action like this is triggered by order status 'assigned'. *Action example:* <verbatim> 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. </verbatim> _NOTE_ * You can use HTML tags in you messages for nicer looking messages including images and logos. -- Main.WiljoVanLenthe - 2012-08-21<br /> -- Main.HenkRoelofs - 2012-05-09
This topic: Cargooffice
>
AboutFreecargo
>
FreightExchangeHowto
>
WebHome
>
ShipmentStatus
>
StatusactionsEditScreen
>
StatusActionsExamples
Topic revision: r9 - 2013-09-11 - WiljoVanLenthe
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback