In if condition you need to use == instead of = oldMaptest1.get(t1.id).subject__c=='America'
Use below code:
public class createTest2whenCreateTest1 {
public static void createtest2(List<test__c> test1list,
Map<id,test__c>oldMaptest1)
{
List<test2__c> test2list = new List<test2__c> ();
for(test__c t1 : test1list )
{
if(t1.subject__c=='London' && oldMaptest1.get(t1.id).subject__c=='America')
{
test2__c t2 = new test2__c();
t2.name='By t1';
t2.test__c = t1.id;
t2.status__c='success';
test2list.add(t2);
}
insert test2list;
}
}
}
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
In if condition you need to use == instead of = oldMaptest1.get(t1.id).subject__c=='America'
Use below code:
public class createTest2whenCreateTest1 {
public static void createtest2(List<test__c> test1list,
Map<id,test__c>oldMaptest1)
{
List<test2__c> test2list = new List<test2__c> ();
for(test__c t1 : test1list )
{
if(t1.subject__c=='London' && oldMaptest1.get(t1.id).subject__c=='America')
{
test2__c t2 = new test2__c();
t2.name='By t1';
t2.test__c = t1.id;
t2.status__c='success';
test2list.add(t2);
}
insert test2list;
}
}
}
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Greetings to you!
In if condition you need to use == instead of =
oldMaptest1.get(t1.id).subject__c=='America'
Use below code:
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
All Answers
public class createTest2whenCreateTest1 {
public static void createtest2(List<test__c> test1list,
Map<id,test__c>oldMaptest1)
{
List<test2__c> test2list = new List<test2__c> ();
for(test__c t1 : test1list )
{
if(t1.subject__c=='London' && oldMaptest1.get(t1.id).subject__c='America')
{
test2__c t2 = new test2__c();
t2.name='By t1';
t2.test__c = t1.id;
t2.status__c='success';
test2list.add(t2);
}
insert test2list;
}
}
}
Greetings to you!
In if condition you need to use == instead of =
oldMaptest1.get(t1.id).subject__c=='America'
Use below code:
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
Thank you.