2

I am editing an existing Trigger where I need to reference a field that starts with 'Check In @'

So I tried using the LIKE operator but it gives an error:

((t.Subject=='Store Check-In' || t.Subject LIKE :'Check In @%')  && t.Completed_Date__c != Null)

So I tried using contains. This did not give an error but it also did not update my field

if ((t.Subject=='Store Check-In' || t.Subject.contains('Check In @%'))  && t.Completed_Date__c != Null)

The logic is supposed to be if an activity subject = 'Store Check-In' OR starts with 'Check In @' AND the complete_Date is not Null then do soemthing.

Any recommendations would be appreciated.
Cheers, M

4

Use startsWith function in String class

t.Subject.startsWith('Check In @')

So the full if condition would be

if ((t.Subject=='Store Check-In' || t.Subject.startsWith('Check In @')) && t.Completed_Date__c != Null)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.