diff --git a/SAILPOINT/Functions/ES_ASSIGN_MAPICS_USER_TO_ROLE.sql b/SAILPOINT/Functions/ES_ASSIGN_MAPICS_USER_TO_ROLE.sql
index e404d02..5435b91 100644
--- a/SAILPOINT/Functions/ES_ASSIGN_MAPICS_USER_TO_ROLE.sql
+++ b/SAILPOINT/Functions/ES_ASSIGN_MAPICS_USER_TO_ROLE.sql
@@ -1 +1,104 @@
-âÅã@×ÁãÈ@\ÓÉÂÓ@^@
%
%ÃÙÅÁãÅ@ÖÙ@ÙÅ×ÓÁÃÅ@ÆäÕÃãÉÖÕ@âÁÉÓ×ÖÉÕãKÅâmÁââÉÇÕmÔÁ×ÉÃâmäâÅÙmãÖmÙÖÓÅ@M@
%ÅÕåÉÄ@ÃÈÁÙMò]@k@
%äâÅÙÕÁÔÅ@ÃÈÁÙMñð]@k@
%äâÅÙÙÖÓÅâ@åÁÙÃÈÁÙMñððð]@]@
%ÙÅãäÙÕâ@ÃÓÖÂMòñô÷ôøóöô÷]@@@
%ÓÁÕÇäÁÇÅ@âØÓ@
%â×ÅÃÉÆÉÃ@âÁÉÓ×ÖÉÕãKÅâÁÄÄÔäâÙÙ@
%ÕÖã@ÄÅãÅÙÔÉÕÉâãÉÃ@
%ÔÖÄÉÆÉÅâ@âØÓ@ÄÁãÁ@
%ÃÁÓÓÅÄ@ÖÕ@ÕäÓÓ@ÉÕ×äã@
%ÕÖã@ÆÅÕÃÅÄ@
%âÅã@Ö×ãÉÖÕ@@ÁÓæÂÓÒ@~@\ÁÓÓÙÅÁÄ@k@
%ÁÓæÃ×èÄãÁ@~@\Ö×ãÉÔÉéÅ@k@
%ÃÖÔÔÉã@~@\ÕÖÕÅ@k@
%ÄÅÃÙÅâäÓã@~@Móñk@óñk@ðð]@k@
%ÄèÕÄÆãÃÖÓ@~@\ÕÖ@k@
%ÄèÕäâÙ×ÙÆ@~@\äâÅÙ@k@
%âÙãâÅØ@~@\ÈÅç@@@
%ÂÅÇÉÕ@
%ÄÅÃÓÁÙÅ@ÓÉÂÓ@åÁÙÃÈÁÙ@M@ñðòô@]@ÄÅÆÁäÓã@}}@^@
%ÄÅÃÓÁÙÅ@ÃäÙmäâÙ@åÁÙÃÈÁÙ@M@ñð@]@ÄÅÆÁäÓã@}}@^@
%ÄÅÃÓÁÙÅ@ÃÖÕãÉÕäÅ@ÈÁÕÄÓÅÙ@ÆÖÙ@âØÓÅçÃÅ×ãÉÖÕ@
%ÂÅÇÉÕ@
%ÄÅÃÓÁÙÅ@åmâØÓâãÁãÅ@ÃÈÁÙ@M@õ@]@^@
%ÄÅÃÓÁÙÅ@åmÄÂòmÙÅãäÙÕmÃÖÄÅ@ÉÕã@^@
%ÄÅÃÓÁÙÅ@åmÄÂòmÔÅââÁÇÅmÉÄ@ÃÈÁÙ@M@÷@]@^@
%ÄÅÃÓÁÙÅ@åmÅÙÙÖÙmÔÅââÁÇÅ@ÃÓÖÂ@M@òðôø@]@^@
%``@Ã�—£¤™…@„‰�‡•–¢£‰ƒ@‰•†–@
%ÇÅã@ÄÉÁÇÕÖâãÉÃâ@ÃÖÕÄÉãÉÖÕ@ñ@
%åmÄÂòmÙÅãäÙÕmÃÖÄÅ@~@ÄÂòmÙÅãäÙÕÅÄmâØÓÃÖÄÅ@k@
%åmâØÓâãÁãÅ@~@ÙÅãäÙÕÅÄmâØÓâãÁãÅ@k@
%åmÅÙÙÖÙmÔÅââÁÇÅ@~@ÔÅââÁÇÅmãÅçã@k@
%åmÄÂòmÔÅââÁÇÅmÉÄ@~@ÄÂòmÔÅââÁÇÅmÉÄ@^@
%ÙÅãäÙÕ@
%M@
%åÁÓäÅâ@ÑâÖÕmÖÂÑÅÃã@M@
%}¢¤ƒƒ…¢¢}@åÁÓäÅ@}†�“¢…}@k@}âØÓÉ•†–}@åÁÓäÅ@ÑâÖÕmÖÂÑÅÃã@M@
%}âØÓâ£�£…}@åÁÓäÅ@åmâØÓâãÁãÅ@k@
%}âØÓÃ–„…}@åÁÓäÅ@åmÄÂòmÙÅãäÙÕmÃÖÄÅ@k@
%}”…¢¢�‡…ÉÄ}@åÁÓäÅ@åmÄÂòmÔÅââÁÇÅmÉÄ@k@
%}”…¢¢�‡…}@åÁÓäÅ@åmÅÙÙÖÙmÔÅââÁÇÅ@k@
%}ƒ¤™™…•£ã‰”…¢£�”—}@åÁÓäÅ@ÃäÙÙÅÕãmãÉÔÅâãÁÔ×@
%]@
%]@]@^@
%ÅÕÄ@^@
%âÅã@ÃÉâãÖÖÓâ@K@ÓÉÂÓ@~@ÃÉâãÖÖÓâ@K@âÅãmÓÉÂÙÁÙèmÓÉâã@M@ÅÕåÉÄ@]@^@
%âÅã@ÃäÙmäâÙ@~@ÃäÙÙÅÕãmäâÅÙ@^@
%ÆÖÙ@âÅÓÅÃã@ÆÙÁÇÔÅÕã@
%ÆÙÖÔ@ãÁÂÓÅ@M@
%ÃÉâãÖÖÓâ@K@â×ÓÉãmâãÙÉÕÇ@M@
%ÙÅÇÅç×mÙÅ×ÓÁÃÅ@M@
%ÃÁâã@M@äâÅÙÙÖÓÅâ@Áâ@åÁÙÃÈÁÙ@M@ñððð@]@ÃÃâÉÄ@ó÷@]@k@
%}ºàºOà»OàÀOàÐOàOàkOà¢N»}@k@}k}@]@k@}k}@]@
%]@
%æÈÅÙÅ@ÆÙÁÇÔÅÕã@Ln@}}@
%ÁÕÄ@ÆÙÁÇÔÅÕã@Éâ@ÕÖã@ÕäÓÓ@
%ÄÖ@
%ÃÁÓÓ@âÁÉÓ×ÖÉÕã@K@ÁââÉÇÕmÅâmäâÅÙmãÖmÙÖÓÅ@M@ÃäÙmäâÙ@k@}Ç}@k@ÆÙÁÇÔÅÕã@k@
%äâÅÙÕÁÔÅ@]@^@@``@�¢¢‰‡•@„…†�¤“£@
%ÅÕÄ@ÆÖÙ@^@
%ÙÅãäÙÕ@
%ÃÖÁÓÅâÃÅ@M@
%ÑâÖÕmÖÂÑÅÃã@M@
%}¢¤ƒƒ…¢¢}@åÁÓäÅ@}£™¤…}@k@}„�£�}@åÁÓäÅ@M@
%âÅÓÅÃã@
%ÑâÖÕmÁÙÙÁèÁÇÇ@M@
%ÑâÖÕmÖÂÑÅÃã@M@
%}¤¢…™É„}@åÁÓäÅ@ÙãÙÉÔ@M@
%ÃÁâã@M@ÅääâÅÙ@Áâ@åÁÙÃÈÁÙ@M@ñð@]@ÃÃâÉÄ@ó÷@]@]@k@
%}™–“…¢}@åÁÓäÅ@ÙÖÓÅâÑâÖÕ@ÆÖÙÔÁã@ÑâÖÕ@
%]@ÆÖÙÔÁã@ÑâÖÕ@
%]@Áâ@ÆÉÕÁÓÑâÖÕ@
%ÆÙÖÔ@ãÁÂÓÅ@M@
%âÅÓÅÃã@ÅääâÅÙ@k@
%ÑâÖÕmÖÂÑÅÃãÁÇÇ@M@ÙãÙÉÔ@M@
%ÃÁâã@M@ÅäÙÖÓÅ@Áâ@åÁÙÃÈÁÙ@M@ñð@]@ÃÃâÉÄ@ó÷@]@]@
%åÁÓäÅ@ÙãÙÉÔ@M@
%ÃÁâã@M@ÅäÄÅâÃ@Áâ@åÁÙÃÈÁÙ@M@õð@]@ÃÃâÉÄ@ó÷@]@]@]@
%Áâ@ÙÖÓÅâÑâÖÕ@
%ÆÙÖÔ@ÅâäâÙ×@
%ÑÖÉÕ@ÅâÙÖÓ×@
%äâÉÕÇ@M@ÅäÙÖÓÅ@]@
%æÈÅÙÅ@ÅääâÅÙ@~@äâÅÙÕÁÔÅ@
%ÇÙÖä×@Âè@ÅääâÅÙ@
%]@]@ÆÖÙÔÁã@ÑâÖÕ@
%]@k@ÑâÖÕmÖÂÑÅÃã@M@
%}¢¤ƒƒ…¢¢}@z@}†�“¢…}@k@}âØÓÉ•†–}@åÁÓäÅ@ÑâÖÕmÖÂÑÅÃã@M@
%}”…¢¢�‡…ÉÄ}@z@}âØÓðòððð}@k@
%}”…¢¢�‡…}@z@}Ù…˜¤…¢£…„@™…¢–¤™ƒ…@•–£@†–¤•„@}@k@
%}ƒ¤™™…•£ã‰”…¢£�”—}@z@ÃäÙÙÅÕãmãÉÔÅâãÁÔ×@
%]@
%]@]@^@
%ÅÕÄ@@^@
%
%ÇÙÁÕã@ÁÓãÅÙ@k@ÅçÅÃäãÅ@@@
%ÖÕ@â×ÅÃÉÆÉÃ@ÆäÕÃãÉÖÕ@âÁÉÓ×ÖÉÕãKÅâÁÄÄÔäâÙÙ@
%ãÖ@ÁÔÁ×ÉÃâ@æÉãÈ@ÇÙÁÕã@Ö×ãÉÖÕ@^@
%
%ÇÙÁÕã@ÅçÅÃäãÅ@@@
%ÖÕ@â×ÅÃÉÆÉÃ@ÆäÕÃãÉÖÕ@âÁÉÓ×ÖÉÕãKÅâÁÄÄÔäâÙÙ@
%ãÖ@×äÂÓÉÃ@^@
%
%
\ No newline at end of file
+SET PATH *LIBL ; 
+
+CREATE OR REPLACE FUNCTION SAILPOINT.ES_ASSIGN_MAPICS_USER_TO_ROLE ( 
+	ENVID CHAR(2) , 
+	USERNAME CHAR(10) , 
+	USERROLES VARCHAR(1000) ) 
+	RETURNS CLOB(2147483647)   
+	LANGUAGE SQL 
+	SPECIFIC SAILPOINT.ESADDMUSRR 
+	NOT DETERMINISTIC 
+	MODIFIES SQL DATA 
+	CALLED ON NULL INPUT 
+	NOT FENCED 
+	SET OPTION  ALWBLK = *ALLREAD , 
+	ALWCPYDTA = *OPTIMIZE , 
+	COMMIT = *NONE , 
+	DECRESULT = (31, 31, 00) , 
+	DYNDFTCOL = *NO , 
+	DYNUSRPRF = *USER , 
+	SRTSEQ = *HEX   
+	BEGIN 
+DECLARE LIBL VARCHAR ( 1024 ) DEFAULT '' ; 
+DECLARE CUR_USR VARCHAR ( 10 ) DEFAULT '' ; 
+DECLARE CONTINUE HANDLER FOR SQLEXCEPTION 
+BEGIN 
+DECLARE V_SQLSTATE CHAR ( 5 ) ; 
+DECLARE V_DB2_RETURN_CODE INT ; 
+DECLARE V_DB2_MESSAGE_ID CHAR ( 7 ) ; 
+DECLARE V_ERROR_MESSAGE CLOB ( 2048 ) ; 
+-- Capture diagnostic info 
+GET DIAGNOSTICS CONDITION 1 
+V_DB2_RETURN_CODE = DB2_RETURNED_SQLCODE , 
+V_SQLSTATE = RETURNED_SQLSTATE , 
+V_ERROR_MESSAGE = MESSAGE_TEXT , 
+V_DB2_MESSAGE_ID = DB2_MESSAGE_ID ; 
+RETURN 
+( 
+VALUES JSON_OBJECT ( 
+'success' VALUE 'false' , 'SQLInfo' VALUE JSON_OBJECT ( 
+'SQLState' VALUE V_SQLSTATE , 
+'SQLCode' VALUE V_DB2_RETURN_CODE , 
+'messageID' VALUE V_DB2_MESSAGE_ID , 
+'message' VALUE V_ERROR_MESSAGE , 
+'currentTimestamp' VALUE CURRENT_TIMESTAMP 
+) 
+) ) ; 
+END ; 
+SET CISTOOLS . LIBL = CISTOOLS . SET_LIBRARY_LIST ( ENVID ) ; 
+SET CUR_USR = CURRENT_USER ; 
+FOR SELECT FRAGMENT 
+FROM TABLE ( 
+CISTOOLS . SPLIT_STRING ( 
+REGEXP_REPLACE ( 
+CAST ( USERROLES AS VARCHAR ( 1000 ) CCSID 37 ) , 
+'[\[|\]|\{|\}|\"|\,|\s+]' , ',' ) , ',' ) 
+) 
+WHERE FRAGMENT <> '' 
+AND FRAGMENT IS NOT NULL 
+DO 
+CALL SAILPOINT . ASSIGN_ES_USER_TO_ROLE ( CUR_USR , 'G' , FRAGMENT , 
+USERNAME ) ;  -- assign default 
+END FOR ; 
+RETURN 
+COALESCE ( 
+JSON_OBJECT ( 
+'success' VALUE 'true' , 'data' VALUE ( 
+SELECT 
+JSON_ARRAYAGG ( 
+JSON_OBJECT ( 
+'userId' VALUE RTRIM ( 
+CAST ( EUUSER AS VARCHAR ( 10 ) CCSID 37 ) ) , 
+'roles' VALUE ROLESJSON FORMAT JSON 
+) FORMAT JSON 
+) AS FINALJSON 
+FROM TABLE ( 
+SELECT EUUSER , 
+JSON_OBJECTAGG ( RTRIM ( 
+CAST ( EUROLE AS VARCHAR ( 10 ) CCSID 37 ) ) 
+VALUE RTRIM ( 
+CAST ( EUDESC AS VARCHAR ( 50 ) CCSID 37 ) ) ) 
+AS ROLESJSON 
+FROM ESUSRP 
+JOIN ESROLP 
+USING ( EUROLE ) 
+WHERE EUUSER = USERNAME 
+GROUP BY EUUSER 
+) ) FORMAT JSON 
+) , JSON_OBJECT ( 
+'success' : 'false' , 'SQLInfo' VALUE JSON_OBJECT ( 
+'messageID' : 'SQL02000' , 
+'message' : 'Requested resource not found ' , 
+'currentTimestamp' : CURRENT_TIMESTAMP 
+) 
+) ) ; 
+END  ; 
+
+GRANT ALTER , EXECUTE   
+ON SPECIFIC FUNCTION SAILPOINT.ESADDMUSRR 
+TO AMAPICS WITH GRANT OPTION ; 
+
+GRANT EXECUTE   
+ON SPECIFIC FUNCTION SAILPOINT.ESADDMUSRR 
+TO PUBLIC ; 
+
