I have developed custom workflow which is creating provisioning plan and do provisioning of an application.(fyi,. only for Add and Remove Entitlement)
Using REST API, launching a workflow and its working fine.
FYI, through workflowArgs i am sending username and multiple responsibilies with different startDate and endDate and i am iterating one by one and creating a plan.
If i use LCM provisioning workflow for provisioning, responsibilies getting added correctly but startDate and endDate it not properly provisioning to target(only last responsibility startDate and endDate is getting added for both responsibilies).
I am using Provisioner class to avoid that issue(which is working fine), Is there any way to handle this type issue?
And If any error comes in Application API response, that I want to print in the response which is our workflow Launch API response. If that is possible, let me know how we can do?
@Venkatesh0510 Have you tried passing the plan to LCM Provisioning workflow? It should generate access request and if there are any failures, it should update the provisioningresult object. Once it is updated there, it should be visible on the access request as well and same can be sent to workflow response as well.
Note: Found a fix?Help the community by marking the comment as solution. Feel free to react(,, etc.)with an emoji to show your appreciation or message me directly if your problem requires a deeper dive.
@Venkatesh0510 Could you please share the code you are using to generate plan and setting start/end date? Also print the plan and share the plan xml as well for review.
@Venkatesh0510 Based on your workflow, you are not setting startDate or endDate at the IIQ level, meant you are not setting the sunrise or sunset date.. Instead you are assigning the responsibility and passing expireDate and effectiveDate as attribute requests.
So your requirement is not to set sunrise/sunset dates in IIQ but pass expireDate/effectiveDate for every responsibility assignment? Is this correct assumption?
also, have you tested the code snippet via rule in IIQ? What is the result.
Please print the plan and share it. I didn’t find it your workflow.
LCM workflow merges/overwrites effectiveDate /expireDate at plan level — last one wins. You need to set dates at AttributeRequest level using sunrise and sunset .
Fix 1: Build Provisioning Plan — Build AttributeRequest
AttributeRequest attrReq = new AttributeRequest(
"entitlements",
ProvisioningPlan.Operation.Add,
responsibilityValue
);
if (startDateVal != null && startDateVal.trim().length() > 0) {
Date sDate = df.parse(startDateVal);
attrReq.setAddDate(sDate); // sunrise — per AttributeRequest
attrReq.setAttribute("sunrise", sDate);
}
if (endDateVal != null && endDateVal.trim().length() > 0) {
Date eDate = df.parse(endDateVal);
attrReq.setRemoveDate(eDate); // sunset — per AttributeRequest
attrReq.setAttribute("sunset", eDate);
}
acctReq.add(attrReq);
Move plan and acctReq creation OUTSIDE the loop, You were creating a new plan and executing inside the loop — that caused only the last dates to survive.
provisioningPlan = new ProvisioningPlan();
provisioningPlan.setIdentity(idName);
AccountRequest acctReq = new AccountRequest(
ProvisioningPlan.AccountRequest.Operation.Modify,
application, null, identityName
);
// your for loop here — only acctReq.add(attrReq) inside loop
// AFTER loop:
provisioningPlan.add(acctReq);
Remove compile/execute from inside the loop. After the loop:
if (!hasErrors) {
ProvisioningProject proj = provisioner.compile(provisioningPlan);
provisioner.execute(proj);
// your result checking code here
}
Update these steps in your workflow and try ii, it should work.