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
vijayabhaskarareddyvijayabhaskarareddy 

I have two name fields name1 and name 2 If name one of any part in name 2 then a check box should be checked.

i have two name fields name1 and name 2
If name one of any part in name 2 then a check box should be checked...
Example 
name 1 =HiTech city
Name2 = Hyd city
City is commom word in both
 So check box checked automatically
GauravGargGauravGarg
Hi Vijaya,
  • Please create a Boolean type field. 
  • Now create a trigger
Trigger Object_Name_Trigger on Sobject_Type(Before Insert, before Update)
{
	for(Sobject_Type so : Trigger.New)
	{
		if(String.isNotBlank(so.Name1__c) && String.isNotBlank(so.Name2__c))
		{
			for(String s : so.Name1__c.split(' '))
			{
				if(so.Name2__c.contains(s))
				{	
					so.Checkbox__c = True;
				}
			}
		}
	}
}


Let me konw if you need more insight on this. 

Thanks,

Gaurav
Skype: gaurav62990
Support: gauravgarg.nmims@gmail.com