Hello, we have done the same thing the past week.
Here's the GEL script I used:
<gel:script xmlns:core="jelly:core" xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary" xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sql="jelly:sql" xmlns:xog="http://www.niku.com/xog"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<gel:setDataSource dbId="niku"/>
<!-- QUERY FOR MULTIPLE RESULTS -->
<sql:query escapeText="0" var="multipleResults">
<![CDATA[/*sql*/
SELECT
RES.unique_name,
RES.email,
RES.first_name,
RES.last_name
FROM
SRM_RESOURCES RES
]]>
</sql:query>
<!-- GET SESSIONID BY USERNAME -->
<core:set value="admin" var="username"/>
<core:new className="com.niku.union.security.DefaultSecurityIdentifier" var="secId"/>
<core:invokeStatic className="com.niku.union.security.UserSessionControllerFactory" method="getInstance" var="userSessionCtrl"/>
<core:set value="${userSessionCtrl.init(username, secId)}" var="secId"/>
<core:set value="${secId.getSessionId()}" var="sessionID"/>
<core:choose>
<core:when test="${sessionID == null}">
<gel:log level="ERROR">Cannot login to Clarity XOG. Check username.</gel:log>
</core:when>
<core:otherwise>
<gel:log>SessionID: ${sessionID}</gel:log>
</core:otherwise>
</core:choose>
<core:forEach items="${multipleResults.rows}" trim="true" var="row">
<!-- Invoke XOG -->
<soap:invoke endpoint="internal" var="result">
<soap:message>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog">
<soapenv:Header>
<xog:Auth>
<xog:SessionID>${sessionID}</xog:SessionID>
</xog:Auth>
</soapenv:Header>
<soapenv:Body>
<NikuDataBus xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/nikuxog_user.xsd">
<Header action="write" externalSource="NIKU" objectType="user" version="16.0.2.861" />
<Users>
<User externalId=" " userName="${row.email}" oldUserName="${row.unique_name}" userLanguage="Spanish" userLocale="es" userUid="${row.unique_name}">
<PersonalInformation emailAddress="${row.email}" firstName="${row.first_name}" lastName="${row.last_name}" />
</User>
</Users>
</NikuDataBus>
</soapenv:Body>
</soapenv:Envelope>
</soap:message>
</soap:invoke>
<!-- Check for errors -->
<gel:set asString="true" select="$result//Statistics/@failureRecords" var="failureRecs"/>
<core:if test="${failureRecs != '0'}">
<gel:log level="ERROR">A Problem with the XOG happened.</gel:log>
<gel:log level="ERROR">Caught Exception was: <gel:expr select="$result"/>
</gel:log>
</core:if>
</core:forEach>
<!-- LOGOUT OF XOG -->
<soap:invoke endpoint="internal" var="logout">
<soap:message>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xog="http://www.niku.com/xog">
<soapenv:Header>
<xog:Auth>
<xog:SessionID>${sessionID}</xog:SessionID>
</xog:Auth>
</soapenv:Header>
<soapenv:Body>
<xog:Logout/>
</soapenv:Body>
</soapenv:Envelope>
</soap:message>
</soap:invoke>
</gel:script>
This effectively changes the username and to their emails. You might want to change the `userLanguage` and `userLocale` to whichever you're using.
Keep in mind that some records might fail to update, like `admin` or any other duplicate email.
Cheers,
Mauro.