Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Figure out the function of that trigger. trigger MSD_TRG_USER_ENGAGE_PERMISSION_SET_AFTER_INSUP on User (after insert,after update) { List UserListToUpdate= new List (); List DeActivatedUser=new List (); if(Trigger.IsInsert)

Figure out the function of that trigger.

trigger MSD_TRG_USER_ENGAGE_PERMISSION_SET_AFTER_INSUP on User (after insert,after update) { List UserListToUpdate= new List(); List DeActivatedUser=new List(); if(Trigger.IsInsert) { for(User NewUser:Trigger.new) { if(NewUser.IsActive) { UserListToUpdate.add(NewUser); } } } if(Trigger.IsUpdate) { for(User UsersNewData:Trigger.new) { for(User UsersOldData:Trigger.old) { If((UsersNewData.Id==UsersOldData.Id)&&(UsersNewData.IsActive==false)&&(UsersOldData.IsActive==true)) { DeActivatedUser.add(UsersNewData); } else If((UsersNewData.Id==UsersOldData.Id)&&(UsersNewData.IsActive==true)&&(UsersOldData.IsActive==false)) { UserListToUpdate.add(UsersNewData); } else if((UsersNewData.Id==UsersOldData.Id)&&(UsersNewData.IsActive==true)&&(UsersOldData.Profile_Name_vod__c!=UsersNewData.Profile_Name_vod__c)) { UserListToUpdate.add(UsersNewData); } } } } if(DeActivatedUser.size()>0) { USER_ENGAGE_PERMISSION_AUTOMATION.removeEngage(DeActivatedUser); String S1=json.serialize(DeActivatedUser); USER_ENGAGE_PERMISSION_AUTOMATION.removePermission(S1); } if(UserListToUpdate.size()>0) { USER_ENGAGE_PERMISSION_AUTOMATION.setEngage(UserListToUpdate); String S2=json.serialize(UserListToUpdate); USER_ENGAGE_PERMISSION_AUTOMATION.setPermission(S2); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions