Skip to main content
Mod Moved Comments To Chat
edited body
Source Link
Brian Mansfield
  • 6.4k
  • 5
  • 37
  • 69

Change this:

Account.Name = ':accName'

to this:

Name = :accName

so your entire query would be:

Account accountId = [
      SELECT Id, Name FROM 
      Account whereWHERE Name = :accName AND Account_External_Id__c != null 
      LIMIT 1
  ];

saying = ':accName' is looking for Accounts with the literal value ":accName" since you wrapped it in single quotes. You don't need single quotes around SOQL bind variables.

You should not have this SOQL query within your for loop - please see Apex best practices. For every iteration of your loop, you will accrue a SOQL query - this will quickly hit governor limits in any type of bulk scenario.

Change this:

Account.Name = ':accName'

to this:

Name = :accName

so your entire query would be:

Account accountId = [
      SELECT Id, Name FROM 
      Account where Name = :accName AND Account_External_Id__c != null 
      LIMIT 1
  ];

saying = ':accName' is looking for Accounts with the literal value ":accName" since you wrapped it in single quotes. You don't need single quotes around SOQL bind variables.

You should not have this SOQL query within your for loop - please see Apex best practices. For every iteration of your loop, you will accrue a SOQL query - this will quickly hit governor limits in any type of bulk scenario.

Change this:

Account.Name = ':accName'

to this:

Name = :accName

so your entire query would be:

Account accountId = [
      SELECT Id, Name FROM 
      Account WHERE Name = :accName AND Account_External_Id__c != null 
      LIMIT 1
  ];

saying = ':accName' is looking for Accounts with the literal value ":accName" since you wrapped it in single quotes. You don't need single quotes around SOQL bind variables.

You should not have this SOQL query within your for loop - please see Apex best practices. For every iteration of your loop, you will accrue a SOQL query - this will quickly hit governor limits in any type of bulk scenario.

added 519 characters in body
Source Link
Brian Mansfield
  • 6.4k
  • 5
  • 37
  • 69

Change this:

Account.Name = ':accName'

to this:

Name = :accName

so your entire query would be:

Account accountId = [
      SELECT Id, Name FROM 
      Account where Name = :accName AND Account_External_Id__c != null 
      LIMIT 1
  ];

saying = ':accName' is looking for Accounts with the literal value ":accName" since you wrapped it in single quotes. You don't need single quotes around SOQL bind variables.

You should not have this SOQL query within your for loop - please see Apex best practices. For every iteration of your loop, you will accrue a SOQL query - this will quickly hit governor limits in any type of bulk scenario.

Change this:

Account.Name = ':accName'

to this:

Name = :accName

saying = ':accName' is looking for Accounts with the literal value ":accName" since you wrapped it in single quotes. You don't need single quotes around SOQL bind variables.

Change this:

Account.Name = ':accName'

to this:

Name = :accName

so your entire query would be:

Account accountId = [
      SELECT Id, Name FROM 
      Account where Name = :accName AND Account_External_Id__c != null 
      LIMIT 1
  ];

saying = ':accName' is looking for Accounts with the literal value ":accName" since you wrapped it in single quotes. You don't need single quotes around SOQL bind variables.

You should not have this SOQL query within your for loop - please see Apex best practices. For every iteration of your loop, you will accrue a SOQL query - this will quickly hit governor limits in any type of bulk scenario.

Source Link
Brian Mansfield
  • 6.4k
  • 5
  • 37
  • 69

Change this:

Account.Name = ':accName'

to this:

Name = :accName

saying = ':accName' is looking for Accounts with the literal value ":accName" since you wrapped it in single quotes. You don't need single quotes around SOQL bind variables.