Forums >> Programming >> Proof of Concept (POC) >>
Initiating an Event




Posted:
bvstone

Initiating an Event

 
Initiating an Event

In our example we are working with a dispatch system to send technicians to locations to perform specific tasks.  

Our online system already allowed the creation of work tickets and allowed us to assign technicians to that specific ticket.  

To incorporate the use of Canvas and the apps, we simply added an option to our work ticket screen to create a dispatch and alert the technician of a job that was ready for them.

In the screen capture above we see that we have a work ticket.  To the left are employees that are assigned to the ticket.  To the right are employees that are available to be assigned to the ticked.

In the list of assigned employees we have a Canvas logo that when clicked, will initiate the creation of a dispatch for that specific employee.

In this next screen shot we see the results after clicking the Canvas logo next to the user of "Brad Stone".  This screen alerts us that in the background there is a process of creating and sending the dispatch to the user.  This is done, in this case, using the GETURI application to make a POST to the Canvas servers.

The POST consists of XML that not only defines which app we want to send (in this case, a Dispatch), but it also defines the values for any data that we want to prefill in the app when the user opens it.  An example of the POST and XML created (using the eRPG SDK, which could also be done with CGIDEV2 or other tools) is as follows:

POST /apiv2/dispatch_items?username=xxxxxxxx&password=xxxxxxxx HTTP/1.0
Accept: text/html
Host: www.gocanvas.com
Content-type: application/x-www-form-urlencoded
Content-length: 907

<?xml version="1.0" encoding="utf-8"?> 
<List> 
	<DI FormName="Dispatch" Description="this is a work ticket (41)" User="bvstone@bvstools.com"> 
		<DIEntry Label="ticket_id" Value="41"/> 
		<DIEntry Label="order_date" Value="04/17/2014"/> 
		<DIEntry Label="customer_email" Value="cindysmith@cindy.com"/> 
		<DIEntry Label="customer_business" Value=""/> 
		<DIEntry Label="customer_contact" Value="Cindy Smith"/> 
		<DIEntry Label="customer_add1" Value="111 Main Street"/> 
		<DIEntry Label="customer_add2" Value=""/> 
		<DIEntry Label="customer_city" Value="Fairhope"/> 
		<DIEntry Label="customer_state" Value="AL"/> 
		<DIEntry Label="customer_zip" Value="60004"/> 
		<DIEntry Label="customer_phone" Value="18478705236"/> 
		<DIEntry Label="default_labor_rate" Value="99.99"/> 
		<DIEntry Label="has_parts" Value="true"/> 
		<DIEntry Label="has_labor" Value="true"/> 
	</DI> 
</List>

The POST is made to a specific URL and also sends the user id and password of an account holder in Canvas. 

The XML contains information such as the name of the form to send (in this case, our Dispatch form), which user to send it to, and any default values.

Once the POST is complete the Canvas application returns XML with any errors, messages, or information.


Last edited 10/02/2014 at 13:23:42


Reply




Copyright 1983-2017 BVSTools
GreenBoard(v3) Powered by the eRPG SDK, MAILTOOL Plus!, GreenTools for Google Apps, jQuery, jQuery UI, BlockUI, CKEditor and running on the IBM i (AKA AS/400, iSeries, System i).