Create IdentityRequest using Rule

Which IIQ version are you inquiring about?

Version 8.2

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

Hi All,

I am trying to create IdentityRequest object using rule. I am able to create object and save it to database but I am not able to get next request number.

Is there any method available in SailPoint which can provide us next request number in rule?

Thanks

I would strongly recommend that you call the LCM workflow or execute Identity Request Initialize from you rule to get the IdentityRequest.
I am not aware if there’s any method to get the next sequence number but the next sequence number is generated from the sequence spt_identity_request_sequence and you can use this sequence to get the next one like ORACLE Database - SELECT spt_identity_request_sequence.nextval FROM DUAL

You can try with below option,

import sailpoint.persistence.Sequencer;
import sailpoint.object.IdentityRequest;

IdentityRequest yourRequest = new IdentityRequest(); 
String  irNum = new Sequencer().generateId(context, yourRequest);

it should work by rule !

Hi @deepakkumar511

did your issue got solved ? pls let us know. if helpful then mark as solved.

 Identity identity = new Identity();

 identity.setAttribute("firstname","TestFirst");
 identity.setAttribute("lastname","TestLast");
 identity.setName("TestFirst.TestLast");


try {
	context.saveObject(identity);
	context.commitTransaction();
} catch (GeneralException e) {
	// TODO Auto-generated catch block
	e.printStackTrace();
}

Can you please share your use case . I don’t see any point to creating the identity request ( better to leave this option to LCM provisioning workflow itself ). If you have any explicit use case which need request to be generated then it make sense and you can use below code to get the sequence .

        import sailpoint.object.IdentityRequest;
        import sailpoint.persistence.Sequencer;

        IdentityRequest request = new IdentityRequest();
        String theNum = new Sequencer().generateId(context, request);
        return theNum;

LCM should be the go-to for creating identityrequest object, A rule could work, identity request object could be created programmatically. I think the sequencer class should resolve this issue. sequence is created through Sequencer. Sequencer class is present inside sailpoint.persistence.Sequencer package.

New object of Sequencer is created by using new Sequencer().

generateId method of Sequencer class is used to generate the new sequence.