As Routes
 

A routing handler defines how a file posted to the handler will be handled.

Any handler can be a routing handler, create the handler as you would do any other, and then click on the Routes command.

When the routes screen displays, click on the Add Route command:

The default definition is displayed:

 

Setting the route

The route is set by using a route map, made up of keywords which will be replaced at run time, along with fixed values.

In this example, we are setting the route map to:

      /$procaccount/$folder0/Reports/$folder1/$file

Here is a table of all of the keywords allowed:

Source Field Meaning
System $today Today’s date in the format yyyy-mm-dd
  $now The date and time in the format yyyy-mm-dd hh:mm:ss
Originator $origaccount Account of the handler call originator
  $orighandler Handler name
Processor $procaccount Account of the processing handler
  $prochandler Handler name
Locator $account Account name in the locator string
  $handler Handler name
  $root / $folder0 Root folder
  $folder<n> Folder number n
  $folder<s>:<e> A range of folders starting with s and ending with e. If s is omitted, 1 is assumed. If e is omitted, the last folder is assumed
  $file File name
  $page Page number
  $all Entire locator

Now lets look at the route map:

      /$procaccount/$folder0/Reports/$folder1/$file

And using a locator string of:

      /store@ecandidus/Gonzalez, Jose/Dr. Jones/Report for 8-10-2010.pdf

Lets map the result:

  • $procaccount - ecandidus
  • $folder0 - Gonzalez, Jose
  • $folder1 - Dr. Jones
  • $file - Report for 8-10-2010.pdf

Now making the replacements we end up with:

      /ecandidus/Gonzalez, Jose/Reports/Dr. Jones/Report for 8-10-2010.pdf

So posting a file to the locator of:

      /store@ecandidus/Gonzalez, Jose/Dr. Jones/Report for 8-10-2010.pdf

Actually posts to the replacement locator above.

 

Handling success or failure...

You can also execute a set of commands when the posting succeeds or fails, by entering the code in the appropriate text areas.

In this case, we are using the follwing code:

email 0 127.0.0.1 name pwd jose.gonzalez@eCandidus.com 'File posted!' 'File $locator has been posted'
   notification.send 1 sam@ecandidus 'Unable to send e-mail, but file posted' $locator
   notification.send 2 '$orighandler@$origaccount' 'Thank you for your submission. You will be contacted shortly.'
else
   notification.send 3 '$orighandler@$origaccount' 'Thank you for your submission. You will see results soon!'
end

Each command is kept in a single line, in this example the command word is shown in bold.

When the post succeds, DMNSion Exchange will execute the line:

   email 0 127.0.0.1 name pwd jose.gonzalez@eCandidus.com 'File posted!' 'File $locator has been posted'

Which tries to send an e-mail message. If this succeeds, the next two lines are executed:

   notification.send 1 sam@ecandidus 'Unable to send e-mail, but file posted' $locator

   notification.send 2 '$orighandler@$origaccount' 'Thank you for your submission. You will be contacted shortly.'

This happens because the two commands are indented.

If the e-mail fails, then the following command is executed:

   notification.send 3 '$orighandler@$origaccount' 'Thank you for your submission. You will see results soon!'

This if/else type logic is done due to the indentaion, and each command can in turn have its own success/failure triggered code.

 

Security

You can select which accounts can use routing handlers by clicking on the Accounts command:

The account screen is displayed.

Start by adding an account:

Here we are adding userco. We set by clicking on the New command:

The account has been added to the handler, now we click on the command to display the settings:

You can tell DMNSion which object commands are allowed. Click on Set command to save.