How can I get Identityrequest createdDate and enddate for an access request

Hi all,

I need to find createdDate and endDate from Identityrequest object. On the behalf of the entitlement request, I want to find the details above. If IdentityRequestitem contains entitlement information, then how can i get dates from identity request? Please suggest to me any filter or some set of codes that will help me to find.

you can use refer sample code

IdentityRequest request = context.getObjectByName(IdentityRequest.class, "<requestId>");
HashMap<String,Object> response = new HashMap<>();
if(request != null) {
      response.put("id", request.getName());
      response.put("created", (request.getCreated() != null) ? String.valueOf(request.getCreated().getTime()) : null);
      response.put("modified", (request.getModified() != null) ? String.valueOf(request.getModified().getTime()) : null);
      response.put("endDate", (request.getEndDate() != null) ? String.valueOf(request.getEndDate().getTime()) : null);
    }
return response; 

Thank you for your response it is great to hear from you but please check the details.

Thanks again for your response ii

@amanKsingh
Can you please more clear here, which created and end date you are expecting and what is the information you have currently.

Hi @iamksatish,
We have Entitlement information requested for users. Entitlement information available in identityRequestItem object and date information available in identityRequest object. So on the behalf of identity request item object which is containing entitlement information. I want to fetch the date from identity request object.

So how can we use join in both the objects in filter.

Hi @amanKsingh,

Please refer to the code below

IdentityRequest request = context.getObjectByName(IdentityRequest.class, “”);
HashMap<String,Object> response = new HashMap<>();
if(request != null) {
response.put(“id”, request.getName());
response.put(“created”, (request.getCreated() != null) ? String.valueOf(request.getCreated().getTime()) : null);
response.put(“modified”, (request.getModified() != null) ? String.valueOf(request.getModified().getTime()) : null);
response.put(“endDate”, (request.getEndDate() != null) ? String.valueOf(request.getEndDate().getTime()) : null);
}
return response;

2 Likes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.