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
SF DEVSF DEV 

How to field value start with 'World*%*'

How to check field value starts with 'World***'

 

 if(T1.WhatId  ==  o.id && T1.Subject == 'Email: 'World.........'' ){

kiranmutturukiranmutturu
we have string methods to do the same .. one is startsWith or startsWithIgnoreCase....methods in string type...

check this http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_string.htm
Vinit_KumarVinit_Kumar

Street 9,

 

Try below :-

 

if(T1.WhatId  ==  o.id && (T1.Subject).startsWith('World') ){

 

SF DEVSF DEV

Tried not entering into if() condition!!

 

Will work aroud.

Vinit_KumarVinit_Kumar

Not sure what is not working for you,the below code works for me:-

 

Task T1 = new Task();
T1.subject ='World is here';
if( (T1.Subject).startsWith('World') ){
system.debug('In if condition');

}

 

vishal@forcevishal@force

Your if condition: if(T1.WhatId  ==  o.id && (T1.Subject).startsWith('World') )

 

It has an "AND" operator, so maybe your first condition there T1.WhatId isn't correctly met? Because otherwise I do not see why this shouldn't work.