@venumgm235 Could you please share the code in clean format.. there is no line breaks, making it difficult to understand and follow.
One quick observation: As it is a modify request, you should also set the nativeIdentity in the Account Request. Also, you can schedule WorkflowRequest.. Here is a sample code:
RequestDefinition reqDef = context.getObjectByName(RequestDefinition.class, "Workflow Request");
Workflow wf = context.getObjectByName(Workflow.class, workflowName);
Identity owner = context.getObjectByName(Identity.class, <youridentity");
if (identity == null || reqDef == null || wf == null || owner == null) {
log.error("LCM deferred provisioning: missing identity/reqDef/workflow/owner for " + identityName);
return;
}
Calendar cal = Calendar.getInstance();
cal.add(Calendar.MINUTE, delayMinutes);
Date executionTime = cal.getTime();
Attributes args = new Attributes();
args.put("workflow", wf.getName());
args.put("plan", plan);
args.put("identityName", identityName);
args.put("launcher", "spadmin");
args.put("flow", "AccountsRequest"); // LCM flow name
args.put("source", "LCM");
args.put("approvalScheme", "none"); // skip approvals for the deferred run
args.put("notificationScheme", "none");
args.put("requestName", "Deferred LCM Provisioning - " + identityName);
Request req = new Request();
req.setDefinition(reqDef);
req.setEventDate(executionTime);
req.setOwner(owner);
req.setName("Deferred LCM Provisioning - " + identityName + " (" + executionTime.getTime() + ")");
req.setAttributes(reqDef, args);
try {
RequestManager.addRequest(context, req);
log.info("Scheduled LCM provisioning workflow '" + workflowName + "' for "
+ identityName + " at " + executionTime);
} catch (Exception e) {
log.error("Failed to schedule LCM provisioning for " + identityName + ": " + e.getMessage(), e);
}