This is my AMPscript code:


 /*Lookup Quoted__c Object*/
 Set @quoted__cRows = RetrieveSalesforceObjects("Quoted__c", "Id,Trade_Confirmation_URL__c,Trade_Confirmation__c", "Id", "=", @Quoted__c:ID)
 set @Quoted__cRowsCount = rowcount(@Quoted__cRows)

 if @Quoted__cRowsCount > 0 then
   set @tradeConfirmationURL = field(row(@accountRows,1),"Trade_Confirmation_URL__c")

 if @Quoted__cRowsCount > 0 then
   set @tradeConfirmation = field(row(@accountRows,1),"Trade_Confirmation__c")


I have a button that redirects to Trade_Confirmation_URL__c. Here is that code:

<table width="200" cellspacing="0" cellpadding="0" border="0" align="center">
       <td style="color: #000001; text-align: center; font-size:12px; font-family: 'Lucida Sans Unicode', 'Lucida Grande', sans-serif;" valign="top" align="left">
            <a href="%%=RedirectTo(Quoted__c:Trade_Confirmation_URL__c)=%%" alias="Apple Trade Confirmation Link" target="_blank">
            <img alt="Complete Trade" src="http://image.contact.phobio.com/lib/fe5215707c610d757313/m/1/3afb3e1e-d1dc-480b-a185-4f06cf345dba.png?b=1519762800000" style="display: block;" width="200" height="40" border="0"></a>

I got this error message from Salesforce

-- Error:- ExactTarget.OMM.InvalidFunctionException: The specified attribute or custom object field name was not found for this client. Function Call: RedirectTo(Quoted:Trade_Confirmation_URL__c) Attribute or Field Name: Quoted:Trade_Confirmation_URL__c Error Code: OMM_FUNC_SYNTAX_ERR - from OMMCommon

  • 1
    please refrain from asking for help in your posts, especially in the title. it will not help draw more attention nor does it make it more relevant. And so your posts are easier to read, make sure you format them properly =) thanks
    – glls
    Jun 6 '18 at 22:54
  • sorry about that. Jun 7 '18 at 0:57

You have to reference the variable in your redirect -- the one you set in the first part:

<a href="%%=RedirectTo(@Trade_Confirmation_URL__c)=%%" >
  <img src="http://placekitten.com/200/40">

Are you sure the first part works? Your lookup variable doesn't seem correct. Shouldn't it be just @ID?


var @id, @row, @quotedRowCount, @tradeConfirmationURL
set @id = AttributeValue("Quoted__c:Id")

set @quotedRows = RetrieveSalesforceObjects(
                    , "Id, Trade_Confirmation_URL__c"
                    , "Id", "=", @id)

set @quotedRowCount = rowcount(@quotedRows)

if @quotedRowCount > 0 then

   set @row = row(@quotedRows,1)
   set @tradeConfirmationURL = field(@row,"Trade_Confirmation_URL__c")


  • I wonder why I am getting a Bad Request - Invalid URL HTTP Error 400. The request URL is invalid. Jun 7 '18 at 2:57
  • so should I remove the "=" and "ID" and just leave the @ID? Jun 7 '18 at 2:59
  • No, you need that. My point is that I don't think this reference is correct: @Quoted__c:ID . Maybe I'm wrong. You're not showing your entire script, so it's hard to tell. Jun 7 '18 at 3:51
  • That is the whole script. Jun 7 '18 at 3:58
  • So what about this answer then? Did you implement what I described? If so then all you should need for your link is %%=RedirectTo(@Trade_Confirmation_URL__c)=%% Jun 7 '18 at 10:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.