Question2Replies77Views SM928K Member since 2019 6 posts P Posted: June 26, 2020Last activity: September 11, 2020 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: 4 months agoUpdated: 4 months agoSM928K P replied to SM928KGot another design to achieve this. Don't bother to reply, thanks! Posted: 2 months agoAhmedA3336 IRIZ-CONSULTING replied to SM928KHi,I have the same issue, how did you achieve you requirement please ?