Last Aggregation Date

Which IIQ version are you inquiring about?

IIQ 8.4

Share all details about your problem, including any error messages you may have received.

Hello Team,

I have a HRMS system that does not return back any terminated employees. So I wanted to keep track of the last aggregation date from the authoritative source.

So I created this rule for the identity attribute and made it searchable:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule language="beanshell" type="IdentityAttribute" name="LAD">
  <Description>
Identity attribute rules are used when the value is not simply a copy of an application account attribute value.  A transformation may be necessary on the account attribute, or several account attributes may need to be combined to produce the identity attribute.

This rule can be called in two ways: as a global mapping rule and an application mapping rule.  A global mapping rule is called whenever the identity is refreshed.  The rule can look at any account attributes.  An application mapping rule is called only when the identity contains an account link for that application, this link is passed in the "link" argument which is not passed in global mapping rules.
  </Description>
  <Signature returnType="String">
    <Inputs>
      <Argument name="environment" type="Map">
        <Description>
           Arguments passed to the aggregation or refresh task.
        </Description>
      </Argument>
      <Argument name="identity">
        <Description>
           The Identity object that represents the user
           that is being aggregated.
        </Description>
      </Argument>
      <Argument name="attributeDefinition">
        <Description>
           The AttributeDefinition object for this attribute.
        </Description>
      </Argument>
      <Argument name="link">
        <Description>
           The Link object from the Identity, if this is an application
           mapping rule.  For global mapping rules this will be void.
        </Description>
      </Argument>
      <Argument name="attributeSource">
        <Description>
          The AttributeSource object.
        </Description>
      </Argument>
      <Argument name="oldValue">
        <Description>
          The original value of the application account attribute.
        </Description>
      </Argument>
    </Inputs>
    <Returns>
      <Argument name="attributeValue">
        <Description>
          The value of the attribute that should be populated.
          The rule should return this value.
        </Description>
      </Argument>
    </Returns>
  </Signature>
  <Source><![CDATA[
        import java.text.SimpleDateFormat;
        import java.util.Date;

        try {
            SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
            String formattedDate = formatter.format(link.getLastTargetAggregation());
            return formattedDate;

        }catch (Exception e) {
            return null;
        }
        ]]></Source>
</Rule>

The problem is that im getting a null pointer exception in my code at line 0.

the identity attribute is set to be an application rule.

Any insights how to tackle this.

Can you try to do a null check for link.getLastTargetAggregation() ?

@AhmedWaleed

Try doing this

Date date = link.getLastTargetAggregation();
    if (date != null) {
        String formattedDate = formatter.format(date);
        return formattedDate;
    }else {
        // handle null date here
        return null;
    }

Hi @AroraA3 and @iamksatish,

I made the following changes and acctually link.getLastTargetAggregation() is coming back as null;

import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;
import java.text.SimpleDateFormat;
import java.util.Date;

Log serilog = LogFactory.getLog("sailpoint.LastTargetAggregationScript");

serilog.debug("Starting script.");

try {
    if (link != null) {
        serilog.debug("Link object is not null.");
        
        if (link.getLastTargetAggregation() != null) {
            serilog.debug("LastTargetAggregation is not null.");
            
            SimpleDateFormat formatter = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
            String formattedDate = formatter.format(link.getLastTargetAggregation());
            
            serilog.debug("Formatted date: " + formattedDate);
            return formattedDate;
        } else {
            serilog.debug("LastTargetAggregation is null.");
            return null;
        }
    } else {
        serilog.debug("Link object is null.");
        return null;
    }
} catch (Exception e) {
    serilog.error("An error occurred: ", e);
    return null;
}

Can I know why the last aggregation date is null shouldn’t it return back the date of the last aggregation where the link was there?

1 Like

@AhmedWaleed
If your intent is to find when the link was last refreshed, use getLastRefresh();

Below is a link which explains the difference

getLastTargetAggregation() method returning null values - Compass (sailpoint.com)

Also are you saying the terminated identities will never be part of source aggregation and you have detect deleted accounts as unchecked in aggregation task?

Thank you.

This helped me alot.

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