0
<force:recordData aura:id="recordLoader" recordId="{!v.recordId}" targetFields="{!v.simpleRecord}" fields="CaseNumber" />
{!v.simpleRecord.CaseNumber}
{!v.recordId}
<center>
    <lightning:button label="Attach file">
        <a href="{!'/p/attach/NoteAttach?pid='+{!v.recordId}+'/parentname='+{!v.simpleRecord.CaseNumber}+'/'+'&retURL=%2F'+{!v.recordId}}" target="_blank">Attach file</a>
    </lightning:button>
</center>

Failed to save CustomAttachmentRelatedList.cmp: c:CustomAttachmentRelatedList:17,118: ParseError at [row,col]:[18,118] Message: The reference to entity "retURL" must end with the ';' delimiter.: Source

I'm getting the above error not sure what is wrong in my URL.

My Expected URL looks like:

https://garvitasb2bsc--4hdev.cs60.my.salesforce.com/p/attach/NoteAttach?pid=5003C000003bdmt&parentname=0114054744&retURL=%2F5003C000003bdmtQAA where ‘500..’ is case id, ‘001’ is the case number.

1

You cannot nest the merge fields. URL must be generated inside the single merge field {!}, and inside you can concatenate the variables and string. Following would be the psuedo code and the query parameters must be separated by ampersand sign (&):

{!'/p/attach/NoteAttach?pid=' + v.recordId + 
    '&amp;parentname=' + v.simpleRecord.CaseNumber + 
    '&amp;retURL=%2F'+ v.recordId }

Note the ampersand (&) is probably reserved character, replace that with &amp;.

| improve this answer | |
  • still i'm getting this error 'Failed to save CustomAttachmentRelatedList.cmp: c:CustomAttachmentRelatedList:17,75: ParseError at [row,col]:[18,75] Message: The reference to entity "parentname" must end with the ';' delimiter.: Source' @Raul – garvita asthana Aug 6 at 16:21
  • The compiler complains about use of ampersand (&) in string, replace it with &amp;, edited the answer to reflect the same – Raul Aug 6 at 16:23
  • thanks! working – garvita asthana Aug 6 at 16:26

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.