[Contents] [Prev] [Next] [Index] [Report an Error] [No Frames]


Test E-Mail Workflow

This section describes a sample workflow that uses the e-mail work items to communicate to the outside world. Although this is not a realistic provisioning workflow, it demonstrates how to use the components. The code is included in the samples package for you to edit and experiment with.

The idea of the provisioning process is simply to send an e-mail to the shipping department, telling an operator to ship a modem to a given user. The message embeds the user's name (the common name or cn attribute from the User object) and address (the street attribute of the User object). Concurrently, another message is sent to another operator, requesting that an e-mail account be established for a given user and a reply be sent specifying the full e-mail address. The return message is parsed to retrieve the e-mail address, which is then used to update the mail attribute of the User object in the directory.

The resulting workflow is shown in Figure 56.


Figure 56: TestEmailWorkflow

The AND work item joins the two concurrent paths and generates a token with a proceed result if both Send E-mail work items are completed successfully. The Send E-mail work items should always be completed successfully in the absence of run-time problems, such as the SMTP server failing to respond or a workflow design error (for example, expecting a parameter in the token that was never retrieved from the directory due to a missing entry in the parameter list).

The parameter list specifies two input parameters, Name and Address, and one output parameter, Mail, which is set by the mail operator and stored back in the User object after the workflow is completed.

NOTE: The GetMailAccount component could have been located between the SetEmail and the AND components. It would not make a difference in this example.


The ShipModem and SetEmail components are instances of the SendEmailWkItem. The bodyText property of the ShipModem component is as follows:

Please ship DSL MODEM to user %Name% at %Address%.
Thanks!

That is the form of embedding token parameters in the message. The inputParameters property contains the Name and Address parameters. There are no output parameters, because a reply is not expected. The sender is specified as workflow@host, so that the recipient knows that this message was sent by the SDX Workflow application. The recipients are simply e-mail addresses. The hostName property specifies the hostname of the SMTP host.

The SetEmail component has a very similar setup, with a similar message and the same SMTP host. The sender is specified as workflow@host. This is the account the E-mail Adapter polls for a reply to the message. The inputParameters property holds only the Name parameter. The outputParameters property specifies Mail as the parameter that the GetMailAccount component is expecting. The bodyText property of this component is as follows:

Set the e-mail account for user %Name% and put it into the placeholder below.
Thanks!


The GetMailAccount component, an instance of ReceiveEmailWkItem, specifies the inputCriteria to be the same as the inputParameters from the SetMail component. Its outputParameters contents are also the same.

If the workflow is triggered to a user with the Name parameter set to John Doe and with the Address parameter set to San Jose, the ShipModem component would produce the following e-mail:

Please ship DSL MODEM to user John Doe at San Jose.
Thanks!

*****The following info is a session cookie, please do not touch it*****
## Name = John Doe
## Address = San Jose
***********************************************************


The SetMail component would produce the following e-mail for the same user:

Set the email account for user John Doe and put it into the placeholder below.
Thanks!


*******In the replying message, please provide the value for *********
## Mail = 
***************************************************************


******The following info is a session cookie, please do not touch it*****
## Name = John Doe
***************************************************************


Looking at this e-mail, you can see how the Receive Email work item works. When the Email Adapter receives the reply, it matches the reply against the GetMailAccount component, which specifies only the Name parameter as part of the inputCriteria property. A possible reply message would be as follows:

>Set the email account for user John Doe and put it into the placeholder below.
>Thanks!
>*******In the replying message, please provide the value for *******
>##Mail=jdoe@isp.com
>**************************************************************
>******The following info is a session cookie, please do not touch it******
>##Name=John Doe
>**************************************************************


In the message above, the operator assigns jdoe@isp.com to the Mail parameter. When the work item executes, it extracts this value and assigns the value to a token parameter named Mail. The Mail parameter is created if it does not yet exist. Notice that only the text after ## is used; everything else is ignored.


[Contents] [Prev] [Next] [Index] [Report an Error] [No Frames]