Skip to main content
deleted 2 characters in body
Source Link
Glenn Daly
  • 567
  • 3
  • 7
  • 22

I have a scheduled class that runs over my Incident records each day to check if any have been resolved for 30,31,32 days.

If it finds any, it should update the status to closed.

An Incident record looks up to the Status object.

The status on Incident is a lookup field called BMCServiceDesk__FKStatus__c

I've been told I need to get the BMCServiceDesk__FKStatus__crecord named "Closed" which has an Id of a4Bw0000000CcCNEA0 somewhere near the start of my code. I need some help on how to do this as I've tried creating a new list for BMCServiceDesk__Status__c object, but it says that i have "Illegal assignment from List to List"

global class Set_Status_Closed_Scheduled  Implements Schedulable // If an Incident has in a static Resolved state for 30 days, change it to Closed
{
global void execute (SchedulableContext sc)
{
    changeStatusToClosed();
}
public void changeStatusToClosed()
{
    // Get Status ID for the ‘Closed’ status.
    
    List<BMCServiceDesk__Status__c> ClosedStatus = new List <BMCServiceDesk__Category__c><BMCServiceDesk__Status__c>();
    
    ClosedStatus = [SELECT Id FROM BMCServiceDesk__Status__c WHERE Name = 'Closed'];
    
    List<BMCServiceDesk__Incident__c> listIncident = new List <BMCServiceDesk__Incident__c>();
    
    List<BMCServiceDesk__Incident__c> updateListIncident = new list <BMCServiceDesk__Incident__c>();
    

    // Below query fetches records from 30 to 32 days. As per our discussion the incident should be closed
    //only after 30 days. So modify below filter logic.
    listIncident = [SELECT Id FROM BMCServiceDesk__Incident__c
                    WHERE (BMCServiceDesk__Status_ID__c = 'Resolved'
                           OR BMCServiceDesk__TemplateName__c = 'Incident Resolved')
                    AND BMCServiceDesk__FKRequestDefinition__c = ''
                    AND (BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:30
                         OR BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:31
                         OR BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:32) LIMIT 100];
    for(BMCServiceDesk__Incident__c up: listIncident)
    {
      
        up.BMCServiceDesk__FKStatus__c = 'a4Bw0000000CcCNEA0';
        
        updateListIncident.add(up);
    }
   
    update updateListIncident;
}

}

I have a scheduled class that runs over my Incident records each day to check if any have been resolved for 30,31,32 days.

If it finds any, it should update the status to closed.

An Incident record looks up to the Status object.

The status on Incident is a lookup field called BMCServiceDesk__FKStatus__c

I've been told I need to get the BMCServiceDesk__FKStatus__crecord named "Closed" which has an Id of a4Bw0000000CcCNEA0 somewhere near the start of my code. I need some help on how to do this as I've tried creating a new list for BMCServiceDesk__Status__c object, but it says that i have "Illegal assignment from List to List"

global class Set_Status_Closed_Scheduled  Implements Schedulable // If an Incident has in a static Resolved state for 30 days, change it to Closed
{
global void execute (SchedulableContext sc)
{
    changeStatusToClosed();
}
public void changeStatusToClosed()
{
    // Get Status ID for the ‘Closed’ status.
    
    List<BMCServiceDesk__Status__c> ClosedStatus = new List <BMCServiceDesk__Category__c>();
    
    ClosedStatus = [SELECT Id FROM BMCServiceDesk__Status__c WHERE Name = 'Closed'];
    
    List<BMCServiceDesk__Incident__c> listIncident = new List <BMCServiceDesk__Incident__c>();
    
    List<BMCServiceDesk__Incident__c> updateListIncident = new list <BMCServiceDesk__Incident__c>();
    

    // Below query fetches records from 30 to 32 days. As per our discussion the incident should be closed
    //only after 30 days. So modify below filter logic.
    listIncident = [SELECT Id FROM BMCServiceDesk__Incident__c
                    WHERE (BMCServiceDesk__Status_ID__c = 'Resolved'
                           OR BMCServiceDesk__TemplateName__c = 'Incident Resolved')
                    AND BMCServiceDesk__FKRequestDefinition__c = ''
                    AND (BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:30
                         OR BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:31
                         OR BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:32) LIMIT 100];
    for(BMCServiceDesk__Incident__c up: listIncident)
    {
      
        up.BMCServiceDesk__FKStatus__c = 'a4Bw0000000CcCNEA0';
        
        updateListIncident.add(up);
    }
   
    update updateListIncident;
}

}

I have a scheduled class that runs over my Incident records each day to check if any have been resolved for 30,31,32 days.

If it finds any, it should update the status to closed.

An Incident record looks up to the Status object.

The status on Incident is a lookup field called BMCServiceDesk__FKStatus__c

I've been told I need to get the BMCServiceDesk__FKStatus__crecord named "Closed" which has an Id of a4Bw0000000CcCNEA0 somewhere near the start of my code. I need some help on how to do this as I've tried creating a new list for BMCServiceDesk__Status__c object, but it says that i have "Illegal assignment from List to List"

global class Set_Status_Closed_Scheduled  Implements Schedulable // If an Incident has in a static Resolved state for 30 days, change it to Closed
{
global void execute (SchedulableContext sc)
{
    changeStatusToClosed();
}
public void changeStatusToClosed()
{
    // Get Status ID for the ‘Closed’ status.
    
    List<BMCServiceDesk__Status__c> ClosedStatus = new List <BMCServiceDesk__Status__c>();
    
    ClosedStatus = [SELECT Id FROM BMCServiceDesk__Status__c WHERE Name = 'Closed'];
    
    List<BMCServiceDesk__Incident__c> listIncident = new List <BMCServiceDesk__Incident__c>();
    
    List<BMCServiceDesk__Incident__c> updateListIncident = new list <BMCServiceDesk__Incident__c>();
    

    // Below query fetches records from 30 to 32 days. As per our discussion the incident should be closed
    //only after 30 days. So modify below filter logic.
    listIncident = [SELECT Id FROM BMCServiceDesk__Incident__c
                    WHERE (BMCServiceDesk__Status_ID__c = 'Resolved'
                           OR BMCServiceDesk__TemplateName__c = 'Incident Resolved')
                    AND BMCServiceDesk__FKRequestDefinition__c = ''
                    AND (BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:30
                         OR BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:31
                         OR BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:32) LIMIT 100];
    for(BMCServiceDesk__Incident__c up: listIncident)
    {
      
        up.BMCServiceDesk__FKStatus__c = 'a4Bw0000000CcCNEA0';
        
        updateListIncident.add(up);
    }
   
    update updateListIncident;
}

}
added 1 character in body
Source Link
Glenn Daly
  • 567
  • 3
  • 7
  • 22

I have a scheduled class that runs over my Incident records each day to check if any have been resolved for 30,31,32 days.

If it finds any, it should update the status to closed.

An Incident record looks up to the Status object.

The status on Incident is a lookup field called BMCServiceDesk__FKStatus__c

I've been told I need to get the BMCServiceDesk__FKStatus__crecord named "Closed" which has an Id of a4Bw0000000CcCNEA0 somewhere near the start of my code. I need some help on how to do this as I've tried creating a new list for BMCServiceDesk__Status__c object, but it says that i have "Illegal assignment from List to List"

global class Set_Status_Closed_Scheduled  Implements Schedulable // If an Incident has in a static Resolved state for 30 days, change it to Closed
{
global void execute (SchedulableContext sc)
{
    changeStatusToClosed();
}
public void changeStatusToClosed()
{
    // Get Status ID for the ‘Closed’ status.
    
    List<BMCServiceDesk__Status__c> ClosedStatus = new List <BMCServiceDesk__Category__c>();
    
    ClosedStatus = [SELECT Id FROM BMCServiceDesk__Status__c WHERE Name = 'Closed'];
    
    List<BMCServiceDesk__Incident__c> listIncident = new List <BMCServiceDesk__Incident__c>();
    
    List<BMCServiceDesk__Incident__c> updateListIncident = new list <BMCServiceDesk__Incident__c>();
    

    // Below query fetches records from 30 to 32 days. As per our discussion the incident should be closed
    //only after 30 days. So modify below filter logic.
    listIncident = [SELECT Id FROM BMCServiceDesk__Incident__c
                    WHERE (BMCServiceDesk__Status_ID__c = 'Resolved'
                           OR BMCServiceDesk__TemplateName__c = 'Incident Resolved')
                    AND BMCServiceDesk__FKRequestDefinition__c = ''
                    AND (BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:030
                         OR BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:31
                         OR BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:32) LIMIT 100];
    for(BMCServiceDesk__Incident__c up: listIncident)
    {
      
        up.BMCServiceDesk__FKStatus__c = 'a4Bw0000000CcCNEA0';
        
        updateListIncident.add(up);
    }
   
    update updateListIncident;
}

}

I have a scheduled class that runs over my Incident records each day to check if any have been resolved for 30,31,32 days.

If it finds any, it should update the status to closed.

An Incident record looks up to the Status object.

The status on Incident is a lookup field called BMCServiceDesk__FKStatus__c

I've been told I need to get the BMCServiceDesk__FKStatus__crecord named "Closed" which has an Id of a4Bw0000000CcCNEA0 somewhere near the start of my code. I need some help on how to do this as I've tried creating a new list for BMCServiceDesk__Status__c object, but it says that i have "Illegal assignment from List to List"

global class Set_Status_Closed_Scheduled  Implements Schedulable // If an Incident has in a static Resolved state for 30 days, change it to Closed
{
global void execute (SchedulableContext sc)
{
    changeStatusToClosed();
}
public void changeStatusToClosed()
{
    // Get Status ID for the ‘Closed’ status.
    
    List<BMCServiceDesk__Status__c> ClosedStatus = new List <BMCServiceDesk__Category__c>();
    
    ClosedStatus = [SELECT Id FROM BMCServiceDesk__Status__c WHERE Name = 'Closed'];
    
    List<BMCServiceDesk__Incident__c> listIncident = new List <BMCServiceDesk__Incident__c>();
    
    List<BMCServiceDesk__Incident__c> updateListIncident = new list <BMCServiceDesk__Incident__c>();
    

    // Below query fetches records from 30 to 32 days. As per our discussion the incident should be closed
    //only after 30 days. So modify below filter logic.
    listIncident = [SELECT Id FROM BMCServiceDesk__Incident__c
                    WHERE (BMCServiceDesk__Status_ID__c = 'Resolved'
                           OR BMCServiceDesk__TemplateName__c = 'Incident Resolved')
                    AND BMCServiceDesk__FKRequestDefinition__c = ''
                    AND (BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:0
                         OR BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:31
                         OR BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:32) LIMIT 100];
    for(BMCServiceDesk__Incident__c up: listIncident)
    {
      
        up.BMCServiceDesk__FKStatus__c = 'a4Bw0000000CcCNEA0';
        
        updateListIncident.add(up);
    }
   
    update updateListIncident;
}

}

I have a scheduled class that runs over my Incident records each day to check if any have been resolved for 30,31,32 days.

If it finds any, it should update the status to closed.

An Incident record looks up to the Status object.

The status on Incident is a lookup field called BMCServiceDesk__FKStatus__c

I've been told I need to get the BMCServiceDesk__FKStatus__crecord named "Closed" which has an Id of a4Bw0000000CcCNEA0 somewhere near the start of my code. I need some help on how to do this as I've tried creating a new list for BMCServiceDesk__Status__c object, but it says that i have "Illegal assignment from List to List"

global class Set_Status_Closed_Scheduled  Implements Schedulable // If an Incident has in a static Resolved state for 30 days, change it to Closed
{
global void execute (SchedulableContext sc)
{
    changeStatusToClosed();
}
public void changeStatusToClosed()
{
    // Get Status ID for the ‘Closed’ status.
    
    List<BMCServiceDesk__Status__c> ClosedStatus = new List <BMCServiceDesk__Category__c>();
    
    ClosedStatus = [SELECT Id FROM BMCServiceDesk__Status__c WHERE Name = 'Closed'];
    
    List<BMCServiceDesk__Incident__c> listIncident = new List <BMCServiceDesk__Incident__c>();
    
    List<BMCServiceDesk__Incident__c> updateListIncident = new list <BMCServiceDesk__Incident__c>();
    

    // Below query fetches records from 30 to 32 days. As per our discussion the incident should be closed
    //only after 30 days. So modify below filter logic.
    listIncident = [SELECT Id FROM BMCServiceDesk__Incident__c
                    WHERE (BMCServiceDesk__Status_ID__c = 'Resolved'
                           OR BMCServiceDesk__TemplateName__c = 'Incident Resolved')
                    AND BMCServiceDesk__FKRequestDefinition__c = ''
                    AND (BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:30
                         OR BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:31
                         OR BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:32) LIMIT 100];
    for(BMCServiceDesk__Incident__c up: listIncident)
    {
      
        up.BMCServiceDesk__FKStatus__c = 'a4Bw0000000CcCNEA0';
        
        updateListIncident.add(up);
    }
   
    update updateListIncident;
}

}
deleted 2 characters in body
Source Link
Glenn Daly
  • 567
  • 3
  • 7
  • 22

I have a scheduled class that runs over my Incident records each day to check if any have been resolved for 30,31,32 days.

If it finds any, it should update the status to closed.

An Incident record looks up to the Status object.

The status on Incident is a lookup field called BMCServiceDesk__FKStatus__c

I've been told I need to get the BMCServiceDesk__FKStatus__crecord named "Closed" which has an Id of a4Bw0000000CcCNEA0 somewhere near the start of my code. I need some help on how to do this as I've tried creating a new list for BMCServiceDesk__Status__c object, but it says that i have "Illegal assignment from List to List"

global class Set_Status_Closed_Scheduled  Implements Schedulable // If an Incident has in a static Resolved state for 30 days, change it to Closed
{
global void execute (SchedulableContext sc)
{
    changeStatusToClosed();
}
public void changeStatusToClosed()
{
    // Get Status ID for the ‘Closed’ status.
    
    List<BMCServiceDesk__Category__c>List<BMCServiceDesk__Status__c> ClosedStatus = new List <BMCServiceDesk__Category__c>();
    
    ClosedStatus = [SELECT Id FROM BMCServiceDesk__Status__c WHERE Name = 'Closed'];
    
    List<BMCServiceDesk__Incident__c> listIncident = new List <BMCServiceDesk__Incident__c>();
    
    List<BMCServiceDesk__Incident__c> updateListIncident = new list <BMCServiceDesk__Incident__c>();
    

    // Below query fetches records from 30 to 32 days. As per our discussion the incident should be closed
    //only after 30 days. So modify below filter logic.
    listIncident = [SELECT Id FROM BMCServiceDesk__Incident__c
                    WHERE (BMCServiceDesk__Status_ID__c = 'Resolved'
                           OR BMCServiceDesk__TemplateName__c = 'Incident Resolved')
                    AND BMCServiceDesk__FKRequestDefinition__c = ''
                    AND (BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:0
                         OR BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:31
                         OR BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:32) LIMIT 100];
    for(BMCServiceDesk__Incident__c up: listIncident)
    {
      
        up.BMCServiceDesk__FKStatus__c = 'a4Bw0000000CcCNEA0';
        
        updateListIncident.add(up);
    }
   
    update updateListIncident;
}

}

I have a scheduled class that runs over my Incident records each day to check if any have been resolved for 30,31,32 days.

If it finds any, it should update the status to closed.

An Incident record looks up to the Status object.

The status on Incident is a lookup field called BMCServiceDesk__FKStatus__c

I've been told I need to get the BMCServiceDesk__FKStatus__crecord named "Closed" which has an Id of a4Bw0000000CcCNEA0 somewhere near the start of my code. I need some help on how to do this as I've tried creating a new list for BMCServiceDesk__Status__c object, but it says that i have "Illegal assignment from List to List"

global class Set_Status_Closed_Scheduled  Implements Schedulable // If an Incident has in a static Resolved state for 30 days, change it to Closed
{
global void execute (SchedulableContext sc)
{
    changeStatusToClosed();
}
public void changeStatusToClosed()
{
    // Get Status ID for the ‘Closed’ status.
    
    List<BMCServiceDesk__Category__c> ClosedStatus = new List <BMCServiceDesk__Category__c>();
    
    ClosedStatus = [SELECT Id FROM BMCServiceDesk__Status__c WHERE Name = 'Closed'];
    
    List<BMCServiceDesk__Incident__c> listIncident = new List <BMCServiceDesk__Incident__c>();
    
    List<BMCServiceDesk__Incident__c> updateListIncident = new list <BMCServiceDesk__Incident__c>();
    

    // Below query fetches records from 30 to 32 days. As per our discussion the incident should be closed
    //only after 30 days. So modify below filter logic.
    listIncident = [SELECT Id FROM BMCServiceDesk__Incident__c
                    WHERE (BMCServiceDesk__Status_ID__c = 'Resolved'
                           OR BMCServiceDesk__TemplateName__c = 'Incident Resolved')
                    AND BMCServiceDesk__FKRequestDefinition__c = ''
                    AND (BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:0
                         OR BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:31
                         OR BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:32) LIMIT 100];
    for(BMCServiceDesk__Incident__c up: listIncident)
    {
      
        up.BMCServiceDesk__FKStatus__c = 'a4Bw0000000CcCNEA0';
        
        updateListIncident.add(up);
    }
   
    update updateListIncident;
}

}

I have a scheduled class that runs over my Incident records each day to check if any have been resolved for 30,31,32 days.

If it finds any, it should update the status to closed.

An Incident record looks up to the Status object.

The status on Incident is a lookup field called BMCServiceDesk__FKStatus__c

I've been told I need to get the BMCServiceDesk__FKStatus__crecord named "Closed" which has an Id of a4Bw0000000CcCNEA0 somewhere near the start of my code. I need some help on how to do this as I've tried creating a new list for BMCServiceDesk__Status__c object, but it says that i have "Illegal assignment from List to List"

global class Set_Status_Closed_Scheduled  Implements Schedulable // If an Incident has in a static Resolved state for 30 days, change it to Closed
{
global void execute (SchedulableContext sc)
{
    changeStatusToClosed();
}
public void changeStatusToClosed()
{
    // Get Status ID for the ‘Closed’ status.
    
    List<BMCServiceDesk__Status__c> ClosedStatus = new List <BMCServiceDesk__Category__c>();
    
    ClosedStatus = [SELECT Id FROM BMCServiceDesk__Status__c WHERE Name = 'Closed'];
    
    List<BMCServiceDesk__Incident__c> listIncident = new List <BMCServiceDesk__Incident__c>();
    
    List<BMCServiceDesk__Incident__c> updateListIncident = new list <BMCServiceDesk__Incident__c>();
    

    // Below query fetches records from 30 to 32 days. As per our discussion the incident should be closed
    //only after 30 days. So modify below filter logic.
    listIncident = [SELECT Id FROM BMCServiceDesk__Incident__c
                    WHERE (BMCServiceDesk__Status_ID__c = 'Resolved'
                           OR BMCServiceDesk__TemplateName__c = 'Incident Resolved')
                    AND BMCServiceDesk__FKRequestDefinition__c = ''
                    AND (BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:0
                         OR BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:31
                         OR BMCServiceDesk__StatusChangeDate__c = LAST_N_DAYS:32) LIMIT 100];
    for(BMCServiceDesk__Incident__c up: listIncident)
    {
      
        up.BMCServiceDesk__FKStatus__c = 'a4Bw0000000CcCNEA0';
        
        updateListIncident.add(up);
    }
   
    update updateListIncident;
}

}
Source Link
Glenn Daly
  • 567
  • 3
  • 7
  • 22
Loading