Please Help, i'm new to AMPSCript here is the error that i get: Error Message:

ExactTarget.OMM.FunctionExecutionException: Invalid index (parameter 2) passed to Row function.  Index must be less than or equal to the row count
 Index Value: 1
  Row Count: 0
  Function: ROW(@From,1)
 - from OMMCommon

Here is my code copied from the HTML, it's inside an email

<custom name="opencounter" type="tracking"> <!--%%[
VAR @Relationship_Manager 
VAR @From

SET @Relationship_Manager = [Lead:Relationship_Manager__c]
SET @From = RetrieveSalesforceObjects('User', 'Id,FirstName,LastName,Email,Phone', 'Id', '=', @Relationship_Manager)

Set @row = ROW(@From,1)
Set @FirstName = FIELD(@row ,"FirstName") 
Set @LastName = FIELD(@row ,"LastName") 
Set @Email = FIELD(@row ,"Email") 
Set @Phone = FIELD(@row ,"Phone") 


2 Answers 2


The error means that you are trying to display the first row from all the records found, but number of records found is 0. Make sure you you have a matching record in your Sales/Service Cloud.

  • the thing is that i'm using the same code in other emails in the same journey and they are working. However this one gave me this error. Having a matching record in sales cloud means that i have to know in which row in Sales cloud this info that i was to retreive is showing? because it's row 3 if i look into salescloud. But i use row 1 in all of the rest
    – Ben M.
    Aug 21, 2019 at 17:51
  • When and how did you get this error? During validation in Journey Builder? I don’t know what you mean by row 3 in SalesCloud but it’s not that — you are trying to match a User where User Id == Relationship Manager, and the data for whatever subscriber you used was not found. Try using a different test subscriber.
    – zuzannamj
    Aug 21, 2019 at 18:15
  • 2
    i would also recommend putting a conditional around your Row() verifying the rowcount before moving forward for better error handling. something like IF Rowcount(@From) > 0 THEN {{your AMPscript}} ELSE Output(Concat('No Rows Found')) ENDIF Aug 21, 2019 at 18:18
  • @CodeRage SF opened a case for the triggered send in the journey and sent me that error by email.
    – Ben M.
    Aug 21, 2019 at 18:48
  • The email is not sent once that error happens and that's exactly what i want. However before i push the journey live, i have to make sure that all emails work so i need to find a solution for it
    – Ben M.
    Aug 21, 2019 at 18:50

The error was not in the AMPscript itself used in the email. It was in the Message configuration of that email in the journey, specifically in the saved send classification and the sender profile. Basically we use what we call an onbehalf sending, which means we send out emails on the behalf of the relationship managers that owns those leads. it is built with AMPscript as well and it retreives the values from sales cloud.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .