We are need to design workflows as per our Business logic which requires the User's information to be passed in workpoint at run time. Is it possible to get user data (e.g. manager attribute value ) from IDM and use it in the Workpoint process. Note that we need the data from the user for whom the task has been initiated.
The only way we've found to implement this - using custom workpoint process agent scripts/emails with scripts/custom resource scripts. We've coded to get user attributes and IM task data (from session attributes) into "User Data" elements in WP. This way we could use that data later on in WP processes.
This is difficult to implement since CA does not provide the API used to integrate IM with WP. We've decompiled the standard CA code to figure out how this works.
This blog: CA Identity Manager IdentityMinder Book Tutorial has some good examples on how to implement advanced workflow (the best content is in the books)
As per our requirement, if the User's manager is changed, a 2 level workflow should be triggered , first approval should be the old manager and the second approval should be the new manager.
If I understand correctly your use case - you have a task where a user's manager gets changed. This task needs to be approved by both the old and new managers. In that case you will probably need a dynamic resolver for at least the original manager since he gets overwritten in the task. The task should have 2 approvers. The WP process could have a server automated step that checks if the manager has changed and move to a single approval/multi approval node if needed.
Did tried the Dynamic resolver, but it get's only new manager details not the old manager's.
Sorry, I had the "Custom" resolver in mind but instead I've written dynamic resolver. You need to code a custom resolver that would get the original attribute value (getLastCommittedAttribute). You can also create a new attribute in the user store (e.g. "oldmanager"). Create a BLTH or PX that would copy the original manager to this attribute during task set subject/initialization stage. Then you can use the dynamic resolver and take the old manager from this attribute. WF process should compare the updated manager and old manager and if they differ then move to WF process where both managers need to approve the task.
The getLastCommittedAttribute drived from Interface AttributeCollection , any idea how can we pass the data into this for from participant resolver Api ?
You can use userProvider to find the user using the participant resolver context.
String uid = ParticipantResolverContext.getSubject().getFriendlyName() <-- this should give you the userid of the user being modified (currently I don't have the means to verify this code)
User user = ParticipantResolverContext.getUserProvider().findUser(uid, null)
String oldmanager = user.getLastCommittedAttribute("manager")
I tired this, but getting error system logs.
InvocationTargetException caught when executing Java class. Command = '#Mon Apr 28 00:41:46 EDT 2003 Parameter4=ThisJobData Parameter3=ThisActivityInstData Parameter2=SymbolTable Parameter1=ClientContext Method=imApprovers JavaClass=com.netegrity.ims.workflowCallbacks.WorkpointRules '; nested exception is: java.lang.ClassCastException: java.lang.String cannot be cast to com.netegrity.llsdk6.imsapi.managedobject.User Error occurred in Statement #1 in Script ID 5:IMOB, Script Name = 'IM Approvers', Script type = 'Resource Select'. Job ID = 126:WPDS, Process Ref = 'IM_160', Node Name = 'Business Approval'
This is just my guess since I don't know your code but it might be that you are returning just the manager ID from your participant resolver. When you have the manager ID you should use the provider accessor to find the manager user object and return it.
User oldmanageruser = ParticipantResolverContext.getUserProvider().findUser(oldmanager, null)
You might also need to return a vector of users (I do not know which is needed but from your error - just returning the user should work):
Vector<User> approvers = new Vector<User>()
Figured out the issue, the return type was mismatch. Workflow is able to resolve both the new and old manager .
Can we put a condition such that if User's manager is changed, that only the workflow should be triggered ?
The only way I could think of to implementing this is by inserting a server automated step at the beginning of the workflow. This step should contain a custom agent that checks if the manager was changed (or it could get this info from the task - set by a blth in a session attribute). It should set the result into the activity user data element (e.g. MANGER_CHANGED="true"/"false") and complete this activity. Then you'd need two transition processes: one for "true" condition that has both managers in the path; the other for when the manager was not changed.
If anyone knows a way to implement this more efficiently I'd be interested to know. Because if you need anything more complicated than the one check at the beginning of the workflow you get a spiderweb of server automated checks if say there are two different approvers for different roles the user can select in a role request task.
Is there any link/URL which can provide help in creating custom agent for work flow
The only examples I am aware of are - samples provided by CA (IAM Suite\Identity Manager\tools\samples\WorkflowContext). There is a sample ApprovalDecision that changes WF flow based on a user's attribute value.
Then there is a book from a blogspot blog:
CA Identity Manager IdentityMinder Book Tutorial: Chapter 4: Workflow and integration
Can you plz share the code or copy-paste the code snippet here?