Technical Articles
How to Find Workflow Agent using Class in Background Task
Scenario: There are few scenarios when Workflow Agent needs to identify based on some custom logic. To identify Agents , can use Custom Class based task which will be called in Background.
Please find steps to Identify Agents using Class Based Task.
1.Create Workflow using SWDD
2. Create Custom Class to identify Workflow Agents.
Add Interfaces-
- BI_OBJECT
- BI_PERSISTENT
- IF_WORKFLOW
3. Create custom Static Method- GET_AGENTS to write logic to fetch agent details.
Put return parameter to send Workflow Agent Details.
Write logic based on requirement.
4. Create Workflow task and assign newly created custom class.
5. Create Email Send Activity and assign Agent Details
Email will be send to respective Agents identified in Custom Static method.
This is used only when BOR objects are not available to get workflow agents and send email functionality.
If you want to find a workflow agents based on custom logic, why not simply use a function module based rule?
If you want the agents for a list of mail recipients and not as a rule result when using a class, you can define them as attributes of the class.
https://blogs.sap.com/2006/08/21/using-abap-oo-attributes-in-workflows-and-tasks/