Here is an AS-IS (I did not test this) Rule for the
Live Events->IN->Create User rule flow.
//These imports go in the Package Imports section of the Create user Rule Flow
import com.engiweb.logger.ILogger
import com.engiweb.logger.impl.Log4JImpl
import com.engiweb.pm.entity.BeanList
import com.engiweb.profilemanager.common.bean.event.EventBean
import com.engiweb.profilemanager.common.bean.event.EventInBean
import com.engiweb.profilemanager.common.bean.ExternalInfo
import com.engiweb.profilemanager.common.bean.OrgUnitBean
import com.engiweb.profilemanager.common.bean.OrgUnitErcBean
import com.engiweb.profilemanager.common.bean.UserBean
import com.engiweb.profilemanager.common.bean.UserErcBean
import com.engiweb.profilemanager.common.bean.UserExtInfoBean
import com.engiweb.profilemanager.common.ruleengine.action.OrgUnitAction
import com.engiweb.profilemanager.common.ruleengine.action.reorganize._RightsAction
import com.engiweb.profilemanager.common.ruleengine.action.reorganize._UserAction
import com.engiweb.profilemanager.common.ruleengine.action.UserAction
import com.engiweb.profilemanager.common.ruleengine.action.UtilAction
import com.engiweb.ruleengine.common.bean.ContainerBean
global com.engiweb.profilemanager.backend.dao.db.SQLH sql
global com.engiweb.logger.impl.Log4JImpl logger
// End imports
when
event : EventInBean( )
userErcBean : UserErcBean( )
userBean : UserBean( )
extInfoBean : ExternalInfo( )
orgUnitBean : OrgUnitBean( )
then
logger.info("Begin My Custom Rule");
String ou = (String) userErcBean.getAttribute("OU");
logger.info("ou is: " + ou);
String ouCode = ou.substring(3);
userErcBean.setAttribute("ATTR2", ouCode);
logger.info("ATTR2 set to: " + ouCode);
logger.info("Exit My Custom Rule");
------------------------------
David Kuehr-McLaren
------------------------------
Original Message:
Sent: Tue December 07, 2021 12:46 PM
From: David Kuehr-McLaren
Subject: IGI - Collect data from HR and manipulate value
Andrea,
Short answer, this can be done from a rule on the IN Queue. If I remember correctly, you need to use the UserErcBean() bean. You will need the rule on the Create Events and the Modify Events. The Modify is a bit more complicated, because you should check to see if the OU has changed before updating ATTR2. If you allow the admins to manually change the OU in the admin UI, then you will add a rule to the the Internal Queue, as well. I will try to find you an example.
David
------------------------------
David Kuehr-McLaren
Original Message:
Sent: Tue December 07, 2021 11:58 AM
From: Andrea Martone
Subject: IGI - Collect data from HR and manipulate value
Dear experts,
Let me start by saying that I'm not a java programmer, I would like to understand if it could be possible to perform the following while interfacing an HR System:
- from JDBC we collect the Org_Unit field (i.e. organizational unit) of Users (e.g. PRC-PR) > OK
- we map Org_Unit field with IGI filed OU and ATTR1 > OK
- Question: Could it be possible to create a rule to manage a new IGI field like ATTR2 populating that with: get only the first 3 letter of Org_Unit field?
Just to be more clear the intention would be to have the following :
HR System | IGI |
Code | Org_Unit | Master UID | OU | ATTR2 |
User 1 | PRC-PR | User 1 | PRC-PR | PRC |
User 2 | P/PRC | User 2 | P/PRC | PRC |
to calculate ATTR2.
Thanks in advance.
------------------------------
Andrea Martone
------------------------------