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
Filippo SalviFilippo Salvi 

Task trigger according to case record type

Hi.
I am quite a principiant in developing Trigger and I have this problem for some trigger that I do not create.
There are some trigger related to the task that update the case status. This triggers seem
 to work just for one case record type but are not working for the rest of case record type.
Could some one, if is possible, help with this matter? I would like to use this triggers for all the case record type.

Thanks in advance.

Filippo
 
Best Answer chosen by Filippo Salvi
ManojjenaManojjena
Hi Filippo,

May be in your code there  is filter for particular record type . You need to remove that filter .Check or if possible post your code I will help you .

Thanks
Manoj

 

All Answers

ManojjenaManojjena
Hi Filippo,

May be in your code there  is filter for particular record type . You need to remove that filter .Check or if possible post your code I will help you .

Thanks
Manoj

 
This was selected as the best answer
Filippo SalviFilippo Salvi
Hi!

Thanks for the answer.

I hope you can help that this think is making me crazy!
Filippo

 
Filippo SalviFilippo Salvi
trigger TaskAfterUpdate on Task (after update) {
/* 

-- -----------  ---------------------------------------
-- AP03         Code to set case status 'All task Closed' if 
--              case if closed and all task of the case is 
                closed.
----------------------------------------------------------------------
**********************************************************************
*/
  System.Debug('## >>> Start of TaskAfterUpdate <<< run by ' + UserInfo.getName());
  //variable  
  //Bypass__c userBypass = Bypass__c.getInstance(UserInfo.getUserId());
  String caseKeyPrefix = AP_Constants.CaseKeyPrefix;
  map<Id,Case> MapCaseIdOfTask = new map<Id,Case>(); //AP03
  map<Id,Case> MapCaseIdOfPendingTask = new map<Id,Case>(); //AP03
  Set<String> setTaskKey = new set<String>(); //AP03
  
  list<Task> listTask = new list<Task>();//AP04
  set<id> setCaseId = new set<id>();
      
    set<id> AP09CaseId= new set<id>();
    list<Task> AP09listTaskClosed= new list<Task>();
  
  //AP10
  set<Id> caseIdSet = new set<Id>();
  list<Task> taskList = new list<Task>();

  for (Integer i=0;i < trigger.size ;i++){
    if(PAD.canTrigger('AP09')){
            if(trigger.new[i].status  != trigger.old[i].status  
                && !trigger.new[i].isclosed
                && trigger.new[i].whatId != null
                && String.ValueOf(trigger.new[i].whatId).startsWith(caseKeyPrefix)
                ){
                    AP09listTaskClosed.add(trigger.new[i]);
                    AP09CaseId.add(trigger.new[i].whatId);
ManojjenaManojjena
Hi Fillipo ,

You have posted half of your code .
Filippo SalviFilippo Salvi
I know.

I cannot post the entire code cause I visualize an error.
There is a way to sand the code?

Thanks.
Filippo
ManojjenaManojjena
Hi Filippo,

You have some classes related to the trigger as well .I am not getting any code which will restrict for a particular reord type .
 
Filippo SalviFilippo Salvi
Thank you very much for the support!!

So if there are not code restrict for record type maybe the causes are the classes related to the trigger?

Filippo
ManojjenaManojjena
Hi Filippo,

I think may be some code is there in your support class .

 
Filippo SalviFilippo Salvi
Hi!
I finally individuate the problem.


code


Now how can I include also two more record type in this?
Filippo SalviFilippo Salvi
I cannot insert the code!
Filippo SalviFilippo Salvi
User-added image