fbpx

How to dynamically display images in Zoho Creator HTML Pages

Dynamic pages in zoho creator

[cs_content][cs_element_section _id=”1″ ][cs_element_layout_row _id=”2″ ][cs_element_layout_column _id=”3″ ][cs_element_text _id=”4″ ][cs_content_seo]we will look at how to display an image in a page using HTML snippet that is already uploaded using another Zoho Creator form.

Now, let’s see how to dynamically display images in the HTML Page.
Create a custom button in the report.

Add deluge openurl task to the custom button action (report workflow). Please note that we are passing the record id as an argument to the parameter name product_id in the url, which can be accessed in the html page.
\n\n[/cs_content_seo][x_code]openUrl(“#page:Product_Details?product_id=”+input.ID,”popup window”);[/x_code][cs_element_text _id=”6″ ][cs_content_seo]Create a Page, add HTML snippet to the page. Add the parameter to page in order to access the argument passed in the url. In this case the argument passed is (record ID).

In the HTML Snippet First, let’s fetch the product data based on the Product id argument passed to the page.

Next, let’s do a quick a Null check to prevent the script from executing unnecessarily when the image is not available for the product.

Here, Products_Report is the Deluge link name of the list report of the Products form.

In the below snippet we are trying to fetch the image url and make it dynamic using the replaceAll function.
\n\n[/cs_content_seo][x_code]<%{
fet = Products[ID == input.product_id.toLong()];
ImageURL = fet.Image.getPrefix(” lowqual”);
Imagename = fet.Image.getsuffix(“/image/”).getPrefix(“\””);
ImageURL = ImageURL.replaceAll(“/sharedBy/appLinkName/”,”/file” + zoho.appuri);
ImageURL = ImageURL.replaceAll(“viewLinkName/”,”Products_Report/” + input.product_id.toLong() + “/”);
ImageURL = ImageURL.replaceAll(“fieldName/image/”,”Image/image-download?filepath=”);
ImageURL = ImageURL.replaceAll(“

<%=ImageURL%>
Product Name: <%=fet.Product%>

<%

}%>[/x_code][cs_element_text _id=”8″ ][cs_content_seo]Now, upon clicking “View product” button against each product in the list report it will display the dynamic page with details corresponding to every record.

\n\n[/cs_content_seo][/cs_element_layout_column][/cs_element_layout_row][/cs_element_section][/cs_content]

đź‘‹ About ThoughtLogik

We’re a team of certified Zoho & Odoo consultants helping businesses automate, scale, and succeed. From CRM to finance, marketing to operations—we design smart solutions that deliver real results.

đź”§Experts in: Zoho, Odoo, Automation, Business Consulting

Subscribe to Our Newsletter

Learn how we helped 100 top brands gain success