You need to sign in to do that
Don't have an account?
sandeepathadu
help in this scenario
hi all
i have written a trigger that will update the account owner name on saving a ticket instead of admin name which is by default
for ex: if i save a ticket i get admin name generally but i have written a trigger and instead of admin name it updates account owner name now the issue is when i deactivate the account owner it should update the user name for this i have written this trigger
trigger caseAssignWebCaseToAccountOwner on Case (before update) { for(case c :trigger.new){ user u = [Select id,name,IsActive from user limit 1 ]; if(c.Origin == 'Portal' && c.SSP_owner_Update__c==false && c.accountid!=null && u.isactive == True){ account a = [select id,name,OwnerId from account where id=:c.accountid]; c.ownerid=a.ownerID; c.SSP_owner_Update__c=true; } if(c.Origin == 'Portal' && u.isactive == False) c.ownerid= '005Q0000000f95r'; } }
but now when i deactivate the account owner and save the ticket it is saying
Operation with Inactive UserAn operation was performed with an inactive user. plz help how to update the ticket name with the user login when we deactivate a account
Hi sandeep,
As you have already deactivated the account owner and trying to assign that owner as Case owner then obviously it will give such error.
If I'm not wrong you want to update the current user as Owner for the case in that scenario check for the Account owner whether he is active or not and if the owner is inactive then mentioned the current user as a Owner using User's Method which we have.
thanks for the reply could u plz rewrite my code using users method plz