Practical Example

In the following example we will analyze each component of a workflow process with return via link.

Development of HTML:

Creating Form WF_FORM.html

HTML  

<head>      

<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">

<title>Workflow per Link</title>  

<head>  

</body>      

<form action=\"mailto:%WFMailTo%\" method=\"POST\" name=\"formulario\">

 Processo generated at !TEXT_TIME!                        

 <br>                                                

 Click here to reply -->                        

<input type=\"submit\" value=\"Send\"/>      

</form>  

</body>

HTML

 

Note:

1. %WFMailTo% points to the recipient command oProcess:cTo := \"HTML\"
2. !TEXT_TIME! Points to the following task and command:
a. oProcess:NewTask(\"FORMULARIO\", \"\Workflow\WF_FORM.html\")
b. oProcess:oHtml:ValByName(\"TEXT_TIME\", Time() )

 

Creating the Link WF_LINK.html

HTML

<head>

<title>Workflow per Link</title>

<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>

<head>

</body>

<form name='form1' method='post' action=''>

 <p>Click the <a href='!A_LINK!'>link</a> to reply.</p>

</form>

</body>

HTML

 

 

Note:

3. !A_LINK! Points to the following commands:
a. oProcess:NewTask(\"LINK\", \"\workflow\WF_LINK.html\")
b. oProcess:oHtml:ValByName(\"A_LINK\", <link destination>)
c. oProcess:cTo := cTo  
d. oProcess:cSubject:= \"Workflow via link.\"
e. oProcess:Start()

 

Development of ADVPL:

Step by step basics:

Local oProcess        := Nil                                            //Object of TWFProcess class.

Local cMailId        := \"\"                                            //ID of the process generated.

Local cHostWF        := \"http://127.0.0.1:8088/wf\"        //URL set in the ini file to WF Link.

Local cTo        := \"[email protected]\"        //Email Recipient.          

 

PREPARE ENVIRONMENT EMPRESA \"01\" FILIAL \"01\"

 

//-------------------------------------------------------------------

// \"FORMULARIO\"

//-------------------------------------------------------------------        

 

// Instantiate the class TWFProcess informing the code and name of the process.

oProcess := TWFProcess():New(\"000001\", \"Treinamento\")

// We create the main task that will be replyed by the user.

oProcess:NewTask(\"FORMULARIO\", \"\Workflow\WF_FORM.html\")

// We assign value to one of the form fields.

oProcess:oHtml:ValByName(\"TEXT_TIME\", Time() )

// We inform the directory used to generate the form.

oProcess:cTo                := \"HTML\"  

// We inform the function run in the event of a timeout.

oProcess:bTimeOut        := {{\"u_wfTimeout()\", 0, 0, 5 }}

// We inform the function run in the event of a return.  

oProcess:bReturn        := \"u_wfRetorno()\"

// We start the task and retrieve the name of generated file.  

cMailID := oProcess:Start()    

 

//-------------------------------------------------------------------

// \"LINK\"

//-------------------------------------------------------------------

 

// We create the link to the file that was generated in the previous task.

oProcess:NewTask(\"LINK\", \"\workflow\WF_LINK.html\")

 

// We assign value to one of the form fields.

oProcess:oHtml:ValByName(\"A_LINK\", cHostWF + \"/messenger/emp\" + cEmpAnt + \"/HTML/\" + cMailId + \".htm\")        

// We inform the recipient of the email containing the link.

oProcess:cTo                := cTo          

// We inform the email subject.

oProcess:cSubject        := \"Workflow via link.\"

// We start the task and send the email to the recipient.

oProcess:Start()