Do a mail-merge using a landing page as the document template

I am starting my first Backendless project. I have designed the DB schema and have loaded a few records for testing purposes. When the Admin user logs in, they may add a new agent. After entering the agent details, I want the Admin to “publish” personal content for this new agent to a folder for the agent. The “publish” process needs to grab landing page templates from a library folder (administered by the Admin) and perform a mail-merge using data from the database and merging it with each existing template to create personalized landing pages to be stored in the agent’s folder.

Hello @Richard_Munger!

It’s great that you’ve chosen Backendless for your project.
Could you please clarify exactly what issues you’re facing that are hindering your progress with this plan?

Regards,
Alexander

I have the following questions:

  1. Should I create a separate file folder for my new template UI pages or should they reside in the standard UI page folder?
  2. When I create a new UI page, how do I setup the fields to be replaced at mail-merge time?
  3. When the mail-merge process has completed, I want to save the result into a file folder personalized for each agent. (i.e. root/PublishedFiles/AgentNumber/filename.html)
  4. Each saved page created by the mail-merge process and saved to the PublishedFiles folder shouls be accessible on the internet. (i.e. https://domainname.com/publishedfiles/agentnumber/pagename.html)

Thank you for detailing your requirements. To better assist you, I would like to ask a few clarifying questions:

  1. Should I create a separate file folder for my new template UI pages or should they reside in the standard UI page folder?

How do you plan to access these templates? Depending on your access patterns, one approach may be more beneficial than the other.

  1. When I create a new UI page, how do I setup the fields to be replaced at mail-merge time?

Could you provide more details about this process?

  1. When the mail-merge process has completed, I want to save the result into a file folder personalized for each agent. (i.e. root/PublishedFiles/AgentNumber/filename.html)

You should be able to accomplish this using File API within the UI Builder. It provides functionality to upload, delete, and retrieve files, which could be used to manage your personalized agent directories.

  1. Each saved page created by the mail-merge process and saved to the PublishedFiles folder shouls be accessible on the internet. (i.e. https://domainname.com/publishedfiles/agentnumber/pagename.html)

Will you be requiring additional security or access control for these pages, or should they be publicly accessible to anyone with the URL?

Regards,
Alexander

Hi @Richard_Munger,

One of the options to consider for the “mail-merge” functionality is to set up the landing pages to function as traditional “app pages”. This means that such a page would be aware of the currently logged-in user (i.e. an agent) and populate the necessary fields with the data from the database. Please let me know if that makes sense and we can dig into the implementation details.

Regards,
Mark

Mark,
Thanks, but the agents will be using the app, only the app admins will use it. The agents are in the field and will only need access to the finished pages

Do the agents have access to the internet? Will the pages be retrieved from a web server?

Yes, the app will generate these customized pages from templates so the agents can use them from the internet for their prospects. The agents may send a link or a qrcode to a prospective client

In this case, I believe the approach I described earlier would work much better for you. A link to such page could be in the following format:

https://yourdomain.com/some-landing-page.html?agentId=xxxxx

Where xxxx would identify the agent. When the page is being rendered, it can load all the required information for agent xxxx and populate the fields.

Regards,
Mark

This is a better solution than creating a separate set of pages for each agent

Yes, it is one of the benefits. Another one would be a simpler implementation.