function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sandeepathadusandeepathadu 

urgent plz help 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 name when we deactivate a account

 

Ankit AroraAnkit Arora

Duplicate Post : http://boards.developerforce.com/t5/General-Development/urgent-plz-help-me-with-the-senario/m-p/313521

 

And tej has already answered the question, if you are not satisfied with the answer then please comment there so all discussion will be at the same place.

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

sandeepathadusandeepathadu

actually its working but i am gettin the default admin user name but i need to get the owner who created the sales force account name plz help resolve the issue