Question1Replies52Views SM928K Member since 2019 4 posts P Posted: 1 month agoLast activity: 1 month 1 week ago Solved Java code transformed in a function throwing error when getting invoked from data transformFollowed below PDN article to achieve the dynamic role addition:https://community.pega.com/knowledgebase/articles/security/how-dynamically-add-roles-during-user-authenticationIt asks to write a java code. We moved that java code in a function.This function when gets called from activity gives no issue but when called from a data transform, getting below error in log:Caused by: com.pega.pegarules.pub.context.PRSecurityException: Activity class must be Code-Security when invoking setRoles()Can someone help me here, why this is happening?Also the article explicitly says, the code will update "pxThread.pxSecuritySnapshot..pxUserRoles" property.Then why can't we directly append the values to this property in Data transform? Why we need java code?***Edited by Moderator: Pallavi to update platform capability tags*** Pega Platform 8.3 Data Integration Java and Activities ×Close popoverFacebookTwitterLinkedinEmail Copy Link Copied! Accepted Solution Posted: 1 month agoUpdated: 1 month agoSM928K P replied to SM928KGot another design to achieve this. Don't bother to reply, thanks!