You need to sign in to do that
Don't have an account?
Travis Wright
Getting a Save error: Expression cannot be assigned on my code and not sure why?
Here is the code that I am using sorry if it is not clean or hard to read new to development and haven't learned how to clean up the mess.
trigger AssignTerritoryType on Account (before insert, before update) {
For (Account a :trigger.new){
Set<string> majorIndustries = new Set<string>{'Pharma/BioTech', 'Energy', 'Fed - Gov' ,'State - Mid','Education'};
if ( (a.NumberOfEmployees >= 10000) ||
(a.AnnualRevenue >= 500000000) ||
(a.Fortune_500__c = true) ||
( (a.Fortune_500_1000__c = True) && (a.NumberOfEmployees >=10000) && (a.AnnualRevenue >= 500000000) ) || //note that even if a.Fortune_500_1000__c = False it'll fall if a.NumberOfEmplyees >=10000 is true or A.AnnualRevenue>=500000000 since it will meet a previous condidtion
majorIndustries.contains(a.Industry) = 'Pharma/BioTech')
{
a.Major__c=true;
}
if ( ((a.NumberOfEmployees < 10000) && (a.NumberOfEmployees >=4000)) ||
((a.AnnualRevenue > 500000000) && (a.AnnualRevenue <=250000000)) ||
((a.Fortune_501_1000__c = true) &&(a.NumberOfEmployees > 10000) && (a.AnnualRevenue > 500000000))||
(majorIndustries.contains(a.Industry) = 'State - mid')||
((a.NumberOfEmployees >=8000) && (majorIndustries.contains(a.Industry) = 'Education')
)
)
{
a.Mid__c=true;
}
if ((a.NumberOfEmployees < 4000) && (a.NumberOfEmployees >=1500)
)
{
a.Inside__c=true;
}
If ((a.NumberOfEmployees < 4000)
)
{
a.Inside_small__c=true;
}
}
}
trigger AssignTerritoryType on Account (before insert, before update) {
For (Account a :trigger.new){
Set<string> majorIndustries = new Set<string>{'Pharma/BioTech', 'Energy', 'Fed - Gov' ,'State - Mid','Education'};
if ( (a.NumberOfEmployees >= 10000) ||
(a.AnnualRevenue >= 500000000) ||
(a.Fortune_500__c = true) ||
( (a.Fortune_500_1000__c = True) && (a.NumberOfEmployees >=10000) && (a.AnnualRevenue >= 500000000) ) || //note that even if a.Fortune_500_1000__c = False it'll fall if a.NumberOfEmplyees >=10000 is true or A.AnnualRevenue>=500000000 since it will meet a previous condidtion
majorIndustries.contains(a.Industry) = 'Pharma/BioTech')
{
a.Major__c=true;
}
if ( ((a.NumberOfEmployees < 10000) && (a.NumberOfEmployees >=4000)) ||
((a.AnnualRevenue > 500000000) && (a.AnnualRevenue <=250000000)) ||
((a.Fortune_501_1000__c = true) &&(a.NumberOfEmployees > 10000) && (a.AnnualRevenue > 500000000))||
(majorIndustries.contains(a.Industry) = 'State - mid')||
((a.NumberOfEmployees >=8000) && (majorIndustries.contains(a.Industry) = 'Education')
)
)
{
a.Mid__c=true;
}
if ((a.NumberOfEmployees < 4000) && (a.NumberOfEmployees >=1500)
)
{
a.Inside__c=true;
}
If ((a.NumberOfEmployees < 4000)
)
{
a.Inside_small__c=true;
}
}
}
trigger AssignTerritoryType on Account (before insert, before update) {
For (Account a :trigger.new){
Set<string> majorIndustries = new Set<string>{'Pharma/BioTech', 'Energy', 'Fed - Gov' ,'State - Mid','Education'};
if ( (a.NumberOfEmployees >= 10000) || (a.AnnualRevenue >= 500000000) || (a.Fortune_500__c = true) || ( (a.Fortune_500_1000__c = True) && (a.NumberOfEmployees >=10000) && (a.AnnualRevenue >= 500000000) ) || majorIndustries.contains('Energy') == True )
{
a.Major__c=true;
}
}
}
All Answers
trigger AssignTerritoryType on Account (before insert, before update) {
For (Account a :trigger.new){
Set<string> majorIndustries = new Set<string>{'Pharma/BioTech', 'Energy', 'Fed - Gov' ,'State - Mid','Education'};
if ( (a.NumberOfEmployees >= 10000) || (a.AnnualRevenue >= 500000000) || (a.Fortune_500__c = true) || ( (a.Fortune_500_1000__c = True) && (a.NumberOfEmployees >=10000) && (a.AnnualRevenue >= 500000000) ) || majorIndustries.contains('Energy') == True )
{
a.Major__c=true;
}
}
}
Final Code
trigger AssignTerritoryType on Account (before insert, before update) {
For (Account a :trigger.new){
Set<string> majorIndustries = new Set<string>{'Pharma/BioTech', 'Energy', 'Fed - Gov' ,'State - Mid','Education'};
if ( (a.NumberOfEmployees >= 10000) ||
(a.AnnualRevenue >= 500000000) ||
(a.Fortune_500__c = true) ||
( (a.Fortune_500_1000__c = True) && (a.NumberOfEmployees >=10000) && (a.AnnualRevenue >= 500000000) ) || //note that even if a.Fortune_500_1000__c = False it'll fall if a.NumberOfEmplyees >=10000 is true or A.AnnualRevenue>=500000000 since it will meet a previous condidtion
majorIndustries.contains('Energy') == True )
{
a.Major__c=true;
}
if ( ((a.NumberOfEmployees < 10000) && (a.NumberOfEmployees >=4000)) ||
((a.AnnualRevenue > 500000000) && (a.AnnualRevenue <=250000000)) ||
((a.Fortune_500_1000__c = true) &&(a.NumberOfEmployees > 10000) && (a.AnnualRevenue > 500000000))||
(majorIndustries.contains('State - Mid')==True ||
((a.NumberOfEmployees >=8000) &&
(majorIndustries.contains('Education')==True)
)
)
)
{
a.Mid__c=true;
}
if ((a.NumberOfEmployees < 4000) && (a.NumberOfEmployees >=1500)
)
{
a.Inside__c=true;
}
If ((a.NumberOfEmployees < 4000)
)
{
a.Inside_small__c=true;
}
}
}