• Shakena Watson
  • NEWBIE
  • 10 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
Hello, I need to do a RPAD on the following statement, but it does not seem to work in a the Select or Where Clause. 

Can a RightPad be use in the following way?

v_year = '2024';
      
       for (Candidate_Recs__c firstAssign : recsToProcess) {
             for (Contact seqAssign : [ Select MIN(lastName.RightPad(40, ' ') +
                    firstName.RightPad(40, ' ') +
                    middleName.RightPad(40, ' ') )
                    , MIN(contact.pre_code)
                 FROM
                  Contact
               WHERE
                      lastName.RightPad(40, ' ') +
                      firstName.RightPad(40, ' ') +
                      middleName.RightPad(40, ' ') +
                     >
                      firstAssign.lastName.RightPad(40, ' ') +
                      firstAssign.firstName.RightPad(40, ' ') +
                      firstAssign.MiddleNameRightPad(40, ' ') +
                  AND Contact.status IN ('AX', 'TQ', 'RO')
                  AND Contact.class_started = :v_class_yr
                  AND Contact.pre_code IS NOT NULL
                  AND Contact.employee_nbr IS NOT NULL]) {
                  
                  //Do Something
              }
}

Thanks for any help in advance.
I will be calling an Apex process to update an object field (not a formula field) when there is an insert, 
update or delete. 

It will update the object field for all records in an object meeting an criteria, not just the records in the 
trigger.new, trigger.old, etc., according to criteria.

Is a trigger the best place to call the process, since it is during a bulk up. 

Should I be using something else (Flow, etc.).

I assume a trigger is the only way know if an object record is inserted into, updated, or deleted .

If a trigger is the route I need to take I need an example of how to call the process in an Apex trigger.

Thanks.
Hello, I need to do a RPAD on the following statement, but it does not seem to work in a the Select or Where Clause. 

Can a RightPad be use in the following way?

v_year = '2024';
      
       for (Candidate_Recs__c firstAssign : recsToProcess) {
             for (Contact seqAssign : [ Select MIN(lastName.RightPad(40, ' ') +
                    firstName.RightPad(40, ' ') +
                    middleName.RightPad(40, ' ') )
                    , MIN(contact.pre_code)
                 FROM
                  Contact
               WHERE
                      lastName.RightPad(40, ' ') +
                      firstName.RightPad(40, ' ') +
                      middleName.RightPad(40, ' ') +
                     >
                      firstAssign.lastName.RightPad(40, ' ') +
                      firstAssign.firstName.RightPad(40, ' ') +
                      firstAssign.MiddleNameRightPad(40, ' ') +
                  AND Contact.status IN ('AX', 'TQ', 'RO')
                  AND Contact.class_started = :v_class_yr
                  AND Contact.pre_code IS NOT NULL
                  AND Contact.employee_nbr IS NOT NULL]) {
                  
                  //Do Something
              }
}

Thanks for any help in advance.
I will be calling an Apex process to update an object field (not a formula field) when there is an insert, 
update or delete. 

It will update the object field for all records in an object meeting an criteria, not just the records in the 
trigger.new, trigger.old, etc., according to criteria.

Is a trigger the best place to call the process, since it is during a bulk up. 

Should I be using something else (Flow, etc.).

I assume a trigger is the only way know if an object record is inserted into, updated, or deleted .

If a trigger is the route I need to take I need an example of how to call the process in an Apex trigger.

Thanks.