Could any one please show me how to make the process to send approve/deny email to the process creator or one who initiate the workflow without hard-code the email address in the "To Addresses" properties of the email service.
In the process data model there is a variable called 'creator_id' which identifies the creator of the process instance. You can use creator_id to query the user repository for an email address, whether it is LDAP or a user database. Alternatively, the email address could be a PDF form field and you could extract the email address from the form data.
Thanks for quick reply. I am still in learning Workbench ES, could you show me how to query the user repository for an email address. I saw that and I have the "To Addresses" property to call that creator_id in XPath expression but I got it stalled with the error: "Recipient address rejected: User unknown in local recipient table". I know it won't work but I want to see the error to see what it really does and I am stuck right here. Could you please show me how to query the user as you have mentioned in your note.
As you have guessed, the creator_id is a string that holds the ID of the process's creator and, unfortunately, none of the send email services allow an email address to be specified as such.
To query for the actual email address of the process creator, use the "Query Single Row" operation of the JDBC service. This service can be found within the "Foundation" category.
The service accepts the following input:
1) Datasource Name: This is a string value that points to the JNDI reference for the data connection you want. If you simply leave this parameter blank, however, it will simply use the default database connection for LiveCycle which has the Adobe database.
2) SQL Statement: Opening up this parameter allows you to type in an actual SQL query. The query you want is as follows:
SELECT A.email FROM LiveCycle_DBO.EDCPRINCIPALENTITY AS A WHERE id = '_________'
The underscores above are where you place your creator_id variable. To do this, simply click the "XPath" button below the text field and add it. I would add that if your LiveCycle database is transactional you should append a WITH (NOLOCK) immediately after your FROM clause to ensure you don't lock the table and disallow other transactions.
3) Data Mapping: Opening this up will allow you to map between data points returned from your query and a process variable within your LiveCycle orchestration. The index column is arbitrary but the Column Name needs to match the respective column names from your query.
The service returns the following output:
1) Number of Rows: An integer value representing the number or rows returned. I believe for this service (Query Single Row), it will always be either 0 or 1.
After running this service, the email address for the originator of your process will be in whatever process variable (String) you assigned it to in the Data Mapping above.
Feel free to shoot me an email should you have any issues or any further questions.