Working on SQL Loader connector in IIQ, can I get the sample code for create?

Which IIQ version are you inquiring about?

Version 8.4

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

Working on SQL Loader connector in IIQ, can I get the sample code for create? Currently getting the target file data clear on account aggregation. Also, can we create separate files for account aggregation and the operations data that is created through read/write?

Hi @SudSharma365, I think this sample code will be helpful.

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.Statement;
import java.sql.SQLException;
import java.util.List;
import java.util.String;
import sailpoint.api.SailPointContext;
import sailpoint.object.Identity;
import sailpoint.object.Schema;
import sailpoint.object.ProvisioningPlan;
import sailpoint.object.ProvisioningPlan.AccountRequest;
import sailpoint.object.ProvisioningPlan.AttributeRequest;
import sailpoint.object.ProvisioningResult;
import sailpoint.tools.xml.XMLObjectFactory;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;
import sailpoint.tools.Util;


ProvisioningResult result = new ProvisioningResult();
if ( plan != null ) {
System.out.println("Entering into the plan : "+plan.toXml());
List accounts = plan.getAccountRequests();
if ( ( accounts != null ) && ( accounts.size() > 0 ) ) {
for ( AccountRequest account : accounts ) {
try {
        System.out.println("The account Request is: "+account);
if ( AccountRequest.Operation.Create.equals( account.getOperation() ) ) {
// Ideally we should first check to see if the account already exists.
// As written, this just assumes it does not.
//System.out.println("Account Operation = ": + account.getOperation());
Identity id= plan.getIdentity();
//String Ident=id.getAttribute("employeeId");
Integer number = Integer.valueOf(id.getAttribute("empId"));
PreparedStatement statement = connection.prepareStatement( "insert into users (user_id, name, first_name, last_name, status, email, Role) values (?,?,?,?,?,?,?);" );
//statement.setString ( 1, id.getAttribute("empId"));
statement.setInt ( 1, number );
statement.setString ( 2, id.getAttribute("displayName"));
statement.setString ( 3, id.getAttribute("firstname"));
statement.setString ( 4, id.getAttribute("lastname"));
statement.setString ( 5, id.getAttribute("status"));
statement.setString ( 6, id.getAttribute("email"));
AttributeRequest attrReq = account.getAttributeRequest("Role");
statement.setString(7, attrReq.getValue());
System.out.println("The attribute Request : "+attrReq);
System.out.println("Preparing to execute: " + statement);
statement.executeUpdate();
statement.close();
result.setStatus( ProvisioningResult.STATUS_COMMITTED );


}
}
catch( SQLException e ) {
result.setStatus( ProvisioningResult.STATUS_FAILED );
result.addError( e );
}
}
}
}
System.out.println("returning the result: "+result.toXml());
return result;`

@SudSharma365 pls check this thread,

It might helpful : SQL Loader, examples for provisioning, enable/disable, update? - IdentityIQ (IIQ) / IIQ Discussion and Questions - SailPoint Developer Community

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