If you want add custom auditing to your beanshell in a rule, task or workflow or any where in the call etc, it's as easy as below , creating the new AuditEvent and setting the Action, Source, Target and values.
Here we need to make sure that we are adding proper action and source so that it's easily tracked .
import sailpoint.api.SailPointContext; import java.text.SimpleDateFormat; import sailpoint.object.AuditEvent;
public void customAudit(SailPointContext context) throws GeneralException{ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); format.setTimeZone(TimeZone.getTimeZone("CST")); AuditEvent auditEvent = new AuditEvent(); auditEvent.setAction("Custom Action"); auditEvent.setSource("Custom Source"); auditEvent.setTarget("vkejriwal"); auditEvent.setString1("Timestamp: " + format.format(new Date())); auditEvent.setString2("User Name: " + "vkejriwal"); auditEvent.setString3("IP: " + "127.0.0.1"); context.saveObject(auditEvent); context.commitTransaction(); }
Custom Audit which is added can be easily seen using the Advance Analytics .