RunRule task to reassign Certifications

Which IIQ version are you inquiring about?

8.3

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

Hello everyone.

In our project, we have several Certifications which are in the Staging phase. For each of these, we have a few hundred identities for which the certifier is not correct.

I was tasked with creating a Rule that can read a pair identity - certifier from a csv file, and reassign the certification items to the correct, certifier.

Currently i have been experimenting with the method: bulkReassign but with no sucess. The task runs with no errors, but there are no differences in the Certification itself.

Is it possible to achieve this?

for(Certification cert: certs){
	List entities = cert.getEntities();
	List currentCertifiers = cert.getCertifiers(); //Current certifiers

	//Check the Entities being targeted by this Certification
	for(CertificationEntity entity: entities){
		List reassignItems = new ArrayList();
		String currentTarget = entity.getIdentity().toLowerCase();

		//See if the map of entity-certifier contains a new Certifier
		if(pairsEntityCertifier.containsKey(currentTarget)){
			String certifier = pairsEntityCertifier.get(currentTarget);

			//Check if certifier is equal to the current one
			if(!currentCertifiers.contains(certifier)){
				System.out.println("Rule-ReadFile-Test Need to update the certifier: " + certifier + " -> " + currentTarget);
				Identity requester = context.getObjectByName(Identity.class, "spadmin");
				Identity recipient = context.getObjectByName(Identity.class, certifier);
				List items = entity.getItems();
				for(CertificationItem item: items){
					reassignItems.add(item);
				}
				//System.out.println("Rule-ReadFile-Test - " + requester + " - " + reassignItems + " - " + recipient);
				cert.bulkReassign(requester, reassignItems, recipient,  "description",  "comments", context.getConfiguration());
				context.saveObject(entity);
				context.saveObject(cert);
				context.commitTransaction();
			}
		}
	}
}
1 Like

Hi @tmamouros,

Can you add exception handling - try catch block with log.debug statements to print and find out whether all the values that are being passed to method cert.bulkReassign are correct ? catch the exceptions and get the exception messages to further troubleshoot what could be the problem.

Hi @vinnysail,
Thanks for the suggestion. I was able to fix it by emplying a Certificationer object :

Certificationer certificationer = new Certificationer(context);

And refreshing the certification:

certificationer.refresh(cert);
1 Like

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