Hi,
I’m trying to create a custom rule to get the Identities assigned to the few Entitlements and generate it as report. the Application is Active Directory Na from there I should filter the entitlements and the identities assigned to it. Can someone help me with the code. Sailpoint version is 8.2.
Hi @likith2501 ,
In this case, you must to declare a datasource in you report, where you define the type of the object how works or write an hql query. Later you can rulo or script for filter or add results.
There you can find the guide:
and this is a topic can help you:
When I am trying to read the properties values, my code is not executed during customization of the report (access request status report). Anyone help why my single line of code not work inside RenderScript?
Please suggest how I can get the properties value. so that I can modify column on that basis.
------------
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE TaskDefinition PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<TaskDefinition created="1631876302095" executor="sailpoint.reporting.LiveRepor…
Which IIQ version are you inquiring about?
Version 8.3
Share all details related to your problem, including any error messages you may have received.
Hello,
I’m implementing a report and I want to allow the user to select multiple types of identities (employee, partner, service, corporate), and both active and inactive identities.
For that I created a form that is referenced in the <ReportForm>:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Form PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<F…
2 Likes
Hi @likith2501 ,
Here is something that could perhaps assist you.
To get the Identities that have links to the Application.
import java.util.List;
import java.util.Iterator;
import sailpoint.object.Identity;
import sailpoint.object.Application;
import sailpoint.object.QueryOptions;
Application application = context.getObjectByName(Application.class, "Active Directory"); // get the application
QueryOptions queryOptions = new QueryOptions();
queryOptions.addFilter(Filter.eq("application.name", application);
Iterator iterator = context.search(Link.class, queryOptions); // get the list of identity links that have active directory
while(iterator.hasNext())
{
Link link = (Link) iterator.next();
Identity identity = link.getOwningIdentity();
// Get the Identity Entitlements
List entitlements = identity.getExceptions();
// Get the entitlements from the application link
List ent = link.getEntitlements();
}
I have an example of generating an account report for an application, this uses a run rule to execute.
<Source>
import java.util.Map;
import java.util.Date;
import java.util.List;
import java.util.HashMap;
import java.util.Iterator;
import java.util.ArrayList;
import sailpoint.tools.Util;
import sailpoint.object.Link;
import java.lang.StringBuilder;
import sailpoint.object.Custom;
import sailpoint.object.Filter;
import sailpoint.object.Schema;
import sailpoint.object.Attributes;
import sailpoint.object.Application;
import sailpoint.object.QueryOptions;
import sailpoint.object.EmailOptions;
import sailpoint.object.EmailTemplate;
import sailpoint.object.EmailFileAttachment;
import sailpoint.object.EmailFileAttachment.MimeType;
private String escapeCsvValue(String value)
{
if(Util.isNotNullOrEmpty(value))
{
value = value.replaceAll("\\r?\\n", " ");
if (value.contains(",") || value.contains("\""))
{
return "\"" + value.replace("\"", "\"\"") + "\"";
}
}
return value;
}
StringBuilder stringBuilder = new StringBuilder();
if(Util.isNullOrEmpty(config.get("application")))
{
throw new Exception("Please ensure that the 'Application' configuration object is present.");
}
Application application = context.getObjectByName(Application.class, config.get("application"));
Schema schema = application.getAccountSchema();
List schemaAttributes = schema.getAttributeNames();
for(String schemaAttribute: schemaAttributes)
{
stringBuilder.append(schemaAttribute).append(",");
}
QueryOptions queryOptions = new QueryOptions();
queryOptions.addFilter(Filter.eq("application.name", config.get("application")));
Iterator iterator = context.search(Link.class, queryOptions);
while(iterator.hasNext())
{
stringBuilder.append("\n");
Link link = (Link) iterator.next();
Map map = link.getAttributes();
for(String schemaAttribute: schemaAttributes)
{
if(map.get(schemaAttribute) != null)
{
String value = map.get(schemaAttribute).toString();
stringBuilder.append(escapeCsvValue(value)).append(",");
continue;
}
stringBuilder.append(",");
}
}
byte[] csvByteArray = stringBuilder.toString().getBytes();
String fileName = "AccountReport.csv";
List emailList = new ArrayList();
emailList.add("*****Your Email Here*****");
EmailOptions emailOptions = new EmailOptions();
EmailTemplate emailTemplate = context.getObjectByName(EmailTemplate.class, "EmailTemplate-GenerateReport");
EmailFileAttachment emailFileAttachment = new EmailFileAttachment(fileName, EmailFileAttachment.MimeType.MIME_CSV, csvByteArray);
emailOptions.setTo(emailList);
emailOptions.setNoRetry(true);
emailOptions.setSendImmediate(true);
emailOptions.addAttachment(emailFileAttachment);
context.sendEmailNotification(emailTemplate, emailOptions);
</Source>
I hope this helps,
3 Likes
Sriindugula
(Sri Veera Siva Kumar Indugula)
July 19, 2024, 10:57am
4
Hi @likith2501
below is the pseudo code (not tested), you can inherit this in the code shared by @dylanfoggan and use it
List returnList = new ArrayList();
List entList = new ArrayList();
entList.add("ent1");
entList.add("ent2");
Application application = context.getObjectByName(Application.class,"Active Directory Application");
for(String groupDN:entList){
if (groupDN != null && groupDN.trim().length() > 0) {
Filter managedAttrFilter = Filter.eq("application", application);
managedAttrFilter = Filter.and(managedAttrFilter, Filter.eq("name", "memberOf"));
managedAttrFilter = Filter.and(managedAttrFilter, Filter.eq("value", groupDN));
QueryOptions qo = new QueryOptions();
qo.addFilter(managedAttrFilter);
List<IdentityEntitlement> idEntitlements = context.getObjects(IdentityEntitlement.class, qo);
if (idEntitlements != null) {
for (IdentityEntitlement idEntitlement : idEntitlements) {
if(null != idEntitlement.getIdentity()){
returnList.add(idEntitlement.getIdentity().getName());
}
}
}
}
}
System.out.println("returnList "+returnList);
Hope this helps!
Thanks
2 Likes
Thanks everyone I will try this codes will see which best fits my requirement.
2 Likes
Sriindugula
(Sri Veera Siva Kumar Indugula)
July 22, 2024, 9:12am
6
Hi @likith2501
If the above information helped for your question, please accept it as solution for the thread. so it will be helpful for others and the issue will be closed.
Thanks
system
(system)
Closed
September 20, 2024, 9:12am
7
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.