• Adrien Smith
  • NEWBIE
  • 0 Points
  • Member since 2014
  • Director of Customer Care
  • Invaluable/ AuctionZip

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
We recently started experiencing an error with converting leads and editing accounts, which I suspect was caused by inactivating a user who is no longer with our company (since this is the only change we have made in the period before this problem started last week). When a user (any user, even an admin) attempts to convert a lead or make an edit they receive:

Error: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, GenerateNewOrder: execution of AfterInsert caused by: System.QueryException: List has no rows for assignment to SObject Trigger.GenerateNewOrder: line 6, column 1: [] (System Code)


After contacting Salesforce Support they suggested that there was an issue with a trigger that was causing the error we were receiving since the trigger was referencing a user who no longer existed. However, I miffed as to WHICH trigger it may be since we have dozens set up. Salesforce support has suggested the following which is essentially Greek to me and I am not quite sure where to start:

1. Check the Debug logs and get to the line number of the class where it's throwing that error message.

You will get a query on that line number.

Run that query in the developer console and you should get zero records.

This error occurs when query doesn't return any rows. For e.g.

Account a = [select id, name from Account where name = 'test'];

To avoid this exception, create a list of account

List<Account> lstAccount = [select id, name from Account where name = 'test'];
if (lstAccount.size() > 0)
{
Account a = lstAccount.get(0);
}

2. Alternatively, you now know the exception, so you can use try/catch as well.


Any suggestions? I'm really unsure where to start by even narrowing down which trigger it should be, just short of going through each and every one...
We recently started experiencing an error with converting leads and editing accounts, which I suspect was caused by inactivating a user who is no longer with our company (since this is the only change we have made in the period before this problem started last week). When a user (any user, even an admin) attempts to convert a lead or make an edit they receive:

Error: System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, GenerateNewOrder: execution of AfterInsert caused by: System.QueryException: List has no rows for assignment to SObject Trigger.GenerateNewOrder: line 6, column 1: [] (System Code)


After contacting Salesforce Support they suggested that there was an issue with a trigger that was causing the error we were receiving since the trigger was referencing a user who no longer existed. However, I miffed as to WHICH trigger it may be since we have dozens set up. Salesforce support has suggested the following which is essentially Greek to me and I am not quite sure where to start:

1. Check the Debug logs and get to the line number of the class where it's throwing that error message.

You will get a query on that line number.

Run that query in the developer console and you should get zero records.

This error occurs when query doesn't return any rows. For e.g.

Account a = [select id, name from Account where name = 'test'];

To avoid this exception, create a list of account

List<Account> lstAccount = [select id, name from Account where name = 'test'];
if (lstAccount.size() > 0)
{
Account a = lstAccount.get(0);
}

2. Alternatively, you now know the exception, so you can use try/catch as well.


Any suggestions? I'm really unsure where to start by even narrowing down which trigger it should be, just short of going through each and every one...