AX1188

Using dynamic email addresses with file processing

When you are emailing the results of multipass file processing, in most cases you will want to dynamically determine the email address for each pass. If instead the email address is hard-coded, then all passes of the process will be sent to the same email address.

NOTE: This discussion does not apply to file collect processing, because the email settings for file collect are defined on the special File Collect Configuration sheet. For more information, see File Collect Configuration sheet and Using multipass processing with file collect.

There are a variety of ways to obtain the appropriate email address for each pass. The method you use will depend on how you have stored email addresses within the system and what dimension you are using to perform the multipass processing. This topic details some examples that you may be able to use directly, or the examples may get you started in the right direction for your particular system.

Example 1: Obtaining email addresses from a reference table

Imagine that you are performing multipass processing by department, and you want to send the output to the "owner" of each department. If the Dept table contains a column that lists the appropriate email address for each department (such as Dept.Email), then you can return this email address using GetCurrentValue.

In this example, you can use GetCurrentValue by itself if you list Dept.Email as an additional source column for the multipass process. In order to do this, you must switch the file processing task pane to Advanced View, and then add Dept.Email as a second source column (assuming the primary source column is Dept.Dept). The multipass settings would look like the following:

For the To field of the Email Settings, you could then enter the following formula:

=GetCurrentValue("Dept.Email")

When multipass processing is performed, this function will return the email address associated with the department for the current pass.

Alternatively, you could use GetCurrentValue to return the department code, and then use GetData to return the email address. When using this approach, you do not need to add any additional source columns to the multipass settings.

=GetData("Dept.Email","Dept="&GetCurrentValue())

Example 2: Obtaining email addresses from security

In order to obtain email addresses from security as part of a multipass process, a user login name must be associated with the multipass source column in some way. For example, you may be performing multipass processing by department, and the Dept table contains a column lists the user name of the department "owner" (such as Dept.Owner). You can return the user name using GetCurrentValue, and then return the email address from security using GetSecurityInfo.

As discussed in the first example, you must first add Dept.Owner as an additional source column for the multipass process (again we are assuming that Dept.Dept is the primary source column for the process). Then in the To field of the Email Settings, you could enter the following formula:

=GetUserInfo("UserEmail",GetCurrentValue("Dept.Owner"))

When multipass processing is performed, the GetCurrentValue function will return the user name from the Owner column for the current department, and then GetUserInfo will return the email address for that user name.

Alternatively you could use GetCurrentValue() with GetData to look up the owner name based on the department code, instead of using Dept.Owner as an additional source column.