/wiki/spaces/E2D/pages/29982926 / Workflow Studio / Workflow Studio / Basic Workflow Examples / Current: Creating Permanent Workflows |
A permanent workflow is a workflow that, based on business needs or requirements, needs to run constantly or run automatically on a consistent schedule. For example, you may wish to create a workflow that runs once a day and sends an e-mail alert to a manager if any of their direct reports had not logged into the system in a certain number of days. In EmpowerID, a permanent workflow can only be run on one EmpowerID server and only one instance of the permanent workflow can run at a time.
Workflow Studio provides a permanent workflow template that makes it easy to create a custom permanent workflow. Once the permanent workflow is published to the EmpowerID server, configuring the job and schedule for the permanent workflow can be achieved with just a few steps in the EmpowerID Web interface. You can set the amount of idle time needed between runs and allow the permanent workflow to loop as needed for your business environment.
This topic demonstrates how to create a permanent workflow by creating one that runs once a day, disabling any user accounts for which the password has not changed in the past 90 days.
In the DoWork_ExecuteCode event, you can either call a SQL stored procedure you created (which is more efficient) or you can write the code to do the work you need done in the permanent workflow.
In this example, we add code to disable an account if the account password has not been changed in 90 days or more.
// create a variable for the total number of Accounts int totalCount; E.TList<Account> accounts = Account.GetAll(0, int.MaxValue, out totalCount); // check each account foreach (Account ac in accounts) { if (ac.Deleted && (ac.PasswordLastChanged == null || ac.PasswordLastChanged.Value.AddDays(90) < DateTime.UtcNow)) { ac.Disable(); } } |
Enter PermanentWorkflow in the Search Tags field, press ENTER and then click Save.
To allow the request workflow to be bound to a Permanent Workflow the workflow must be tagged with the PermanentWorkflow tag. The drop-down that allows you to select a request workflow for a permanent workflow lists only those request workflows with this tag. |
|