1

What I have tried :

1) I already have a Campaign Member custom field (Using Formula Text) showing QR code on the detail page tied to their respective Campaign Member Id

Campaign Member Id

E.g. IMAGE('http://api.qrserver.com/v1/create-qr-code/?size=200x200&qzone=1&data=<Force.com site> + Id, 'QR Code').

Then from there I will call using merge field on the HTML Email Template like {!CampaignMember.QrCode__c}. When testing it by getting it to send to my personal email inbox, by right it should have shown the QR Code image generated but instead just shows the string "QR Code"

2) I have seen many answers online telling me I should upload it to Documents. However, if I have >100 Campaign Members, I would then need to upload >100 Qr code generated images with unique IDs on Documents? (So definitely can't go with this approach)

3) Making the html tag dynamic in HTML Email Template itself like

<img src="http://api.qrserver.com/v1/create-qr-code/?size=200x200&qzone=1&data=http%3A%2F%2Fvictorng-dev-ed--c.ap2.visual.force.com%2Fapex%2FCampaignMemberQRCodeAttendance_Std%3Fid%3D"
+ {!CampaignMember.QRCode__c}>

But when scanning the QR code it will open the url https://victorng-developer-edition.ap2.force.com/TestVF?id= without the Campaign Member Id. Is there a way to concat the id with the url?

1 Answer 1

2

If all you see in your email client is "QR Code" (the image's alt attribute) it sounds like the email client is configured to not download images from external websites. Check if you have a warning similar to this:

enter image description here (Image copied from https://www.wintips.org/wp-content/uploads/2017/06/image-8.png)

Alternatively you can also try to inspect the raw HTML of the message (in Gmail web client it's "show original" option in the dropdown menu) to verify the link is constructed OK, it's "just" that protection kicks in.

Not sure what you can do about it to be honest. Quite a lot of spammers / scammers / semi-legitimate marketing people try to get their images to display so they can "phone home" and report that this particular email was opened. It's called "tracking pixel" or "web beacon" and even SF uses it to track the Campaign Members.


Couple ideas:

  • You could ask clients to add your emails to "white list" (this might mean adding Salesforce and / or this server that generates images for you)
  • You could try embedding the image in the email directly. If you have the bitmap or PNG, you could save it as an Attachment under "this" record and then also add it as an Attachment to the email. It might be that the best way to do it will be to base64-encode the PNG and send it as "data URI scheme":
  • You could add the document you need as a PDF attachment to your email (possible if you have a Visualforce email template). Normally the PDF generator SF uses doesn't display images from external servers nicely (that's why it's best idea to have them added to Static Resources or Documents). But if you'll add an exception to Remote Site Settings then the PDF generator should be able to fetch the image from external site and embed it nicely in the PDF)
  • As for your #3, the Campaign Member Id missing - either you screwed up while anonymising the code to post it here or you're using the wrong merge field. You want it to be

    img src="http://api.qrserver.com/v1/create-qr-code/?size=200x200&qzone=1&data=http%3A%2F%2Fvictorng-dev-ed--c.ap2.visual.force.com%2Fapex%2FCampaignMemberQRCodeAttendance_Std%3Fid%3D" + {!CampaignMember.Id}
    

    right? not the QRCode__c. Again - your best choice would be to inspect the raw generated HTML of the email and experiment a bit. (And maybe use some URLFOR / URLENCODE to do the escaping automatically)

You must log in to answer this question.

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