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
suji srinivasansuji srinivasan 

how to update records using invocable apex in flows with ID NOT IN condition in soql ?

public class Update_salary_Recordstatus_as_Inactive {
    @InvocableMethod(label='Update salary  Recordstatus as Inactive' description='Returns the list of salary active records' )
    Public static List<Salary_Detail__c> getsalary(List<id> Ids){
   // Set<String> EmployeeId = new Set<String>();
    Id auRecordTypeId = Schema.SObjectType.Salary_Detail__c.getRecordTypeInfosByName().get('Compensation').getRecordTypeId();
    //for(Employee_Information__c e :[select id,Employee_Id__c from Employee_Information__c where Tax_Regime__c!=null AND Employee_Id__c != Null ] ){
          //  EmployeeId.add(e.Employee_Id__c);}
    List<Salary_Detail__c>sallist =[select id,Employee_First_Name__c,Employee_Last_Name__c,Employee_Information__c,RecordTypeId,Employee_ID__c,Confirmed_CTC__c,Record_Status__c,Date_of_Joining__c from Salary_Detail__c WHERE RecordTypeId =:auRecordTypeId AND Record_Status__c='Active' AND ID =:IDs  ];
    List<Salary_Detail__c>tobeinactive = [select id,Employee_First_Name__c,Employee_Last_Name__c,Employee_Information__c,RecordTypeId,Employee_ID__c,Confirmed_CTC__c,Record_Status__c,Date_of_Joining__c from Salary_Detail__c WHERE RecordTypeId =:auRecordTypeId AND Record_Status__c='Active' AND ID NOT IN :IDs  ];

        List<Salary_Detail__c>Inactivesallist = new  List<Salary_Detail__c> ();
        
    for (Salary_Detail__c s :tobeinactive){
       
            s.Record_Status__c ='Inactive';  
            Inactivesallist.add(s);  
        system.debug(' Inactivesallist......'+ Inactivesallist);
           }
   update Inactivesallist;
  return Inactivesallist;                                

 }

Inputs: $record.id

I need to update record other than this input . can anyone guide me. Thanks in advance