How to display images dynamically on a subform row based on the lookup field selection | Zoho Creator Help

How to display images dynamically on a subform row based on the lookup field selection

The images stored in a form can be retrieved and displayed dynamically within subforms. When users select a record from a lookup field in a subform row, relevant images associated with that record can appear in a designated rich text field within the same row. This functionality enhances the user experience by providing a visual reference for each selection, ensuring that users can quickly identify items without needing to navigate to separate views or records. 
This can be useful in the cases of order management where the user can place an order by selecting the preferred product from the lookup field. The relevant image will be shown in the rich text field of the same row.
In this tutorial, we'll focus on creating two forms, Store Images and Display Images. The Store Images form will include an image field to store images and a single-line field to record a reference name for each image. The Display Images form will have a subform containing a lookup field to select a reference name from the Store Images form. Based on this lookup selection, the corresponding image will be displayed dynamically within the subform.
Notes
Note: The report from the Store Images form will be published to obtain an encrypted key. This key will be used within a function to facilitate image previewing.
  1. Create forms with the following details to display image dynamically on a subform row based on the lookup field selection.

    Form

    Form Link Name

    Field Type

    Field Name

    Field Link Name

    Store Image

    Store_Image

    Single Line

    Reference Name

    Reference_Name

    Image

    Image

    Image

    Display Images

    Display_Images

    Subform

    • Lookup(Store Image)

    • Rich Text

      

    Subform

    • Image Reference Name

    • Image Preview

    Subform

    • Image_Reference_Name

    • Image_Preview

    1. NotesNote: Uncheck all toolbar options in the field properties of the rich text field to hide its toolbar when accessed by the user.

  2. Publish the report of the Store Images form. In our case, it will be Store Images Report.

  3. Create a workflow to execute on the user input of the Image Reference Name  field in the subform of the Display Images form. Select the Record Event as created or edited. This workflow will fetch the image from the Store Images form and previews it in the Rich Text field based on the Image Reference Name selected in the subform of the Display Images form.

  4. Click Add New Action and add the following script in the Deluge editor.
if(row.Reference_Name != null)
  1. {
  2.  //Fetch the image record from the Store Images form by matching the ID in the Reference Name Lookup selection.
  3.  fetch_Record = Store_Images[ID == row.Image_Reference_Name];
  4.  //Fetch the Image URL
  5.  fetch_imageUrl = fetch_Record.Image;
  6.  //Constrct the Public URl for the image.
  7.  subStringStart = fetch_imageUrl.lastIndexOf("image/") + 6;
  8.  subStringEnd = fetch_imageUrl.lastIndexOf("\" border");
  9.  imagePath = fetch_imageUrl.subString(subStringStart,subStringEnd);
  10.  Public_image = "https://creator.zohopublic.com"+zoho.appuri+"Store_Images_Report/" + row.Image_Reference_Name + "/Image/image-download/<encryptedKey>/" + imagePath;
  11.  // Populate the image in the rich text field.
  12.  row.Rich_Text="<img src=" + img + " width='100' height='100'>";
  13. }

Where,
<encryptedKey>
is the unique key that is generated while publishing the report. It can be located within the URL of the published report. For example, in the following publish URL:  https://creatorapp.zohopublic.com/zylker/it-asset-tracker/report-perma/All_Store_Images/nDm8eJMv4TTKMd1qOZnqA0Je8dj90rW0CbQZBBPZxZd6fM02GmuUnPa962bDKWPXmnJ8vEMdF7rpWgM3jhRb6SR8kd213G2b4nbt

the encrypted key is as follows:
nDm8eJMv4TTKMd1qOZnqA0Je8dj90rW0CbQZBBPZxZd6fM02GmuUnPa962bDKWPXmnJ8vEMdF7rpWgM3jhRb6SR8kd213G2b4nbt

See how it works


  1. Fetch records
  2. Publish reports

      Create. Review. Publish.

      Write, edit, collaborate on, and publish documents to different content management platforms.

      Get Started Now


        Access your files securely from anywhere

          Zoho CRM Training Programs

          Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

          Zoho CRM Training
            Redefine the way you work
            with Zoho Workplace

              Zoho DataPrep Personalized Demo

              If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

              Zoho CRM Training

                Create, share, and deliver

                beautiful slides from anywhere.

                Get Started Now


                  Zoho Sign now offers specialized one-on-one training for both administrators and developers.

                  BOOK A SESSION







                              Quick LinksWorkflow AutomationData Collection
                              Web FormsEnterpriseOnline Data Collection Tool
                              Embeddable FormsBankingBegin Data Collection
                              Interactive FormsWorkplaceData Collection App
                              CRM FormsCustomer ServiceAccessible Forms
                              Digital FormsMarketingForms for Small Business
                              HTML FormsEducationForms for Enterprise
                              Contact FormsE-commerceForms for any business
                              Lead Generation FormsHealthcareForms for Startups
                              Wordpress FormsCustomer onboardingForms for Small Business
                              No Code FormsConstructionRSVP tool for holidays
                              Free FormsTravelFeatures for Order Forms
                              Prefill FormsNon-Profit
                              Intake FormsLegalMobile App
                              Form DesignerHRMobile Forms
                              Card FormsFoodOffline Forms
                              Assign FormsPhotographyMobile Forms Features
                              Translate FormsReal EstateKiosk in Mobile Forms
                              Electronic Forms
                              Drag & drop form builder

                              Notification Emails for FormsAlternativesSecurity & Compliance
                              Holiday FormsGoogle Forms alternative GDPR
                              Form to PDFJotform alternativeHIPAA Forms
                              Email FormsEncrypted Forms

                              Secure Forms

                              WCAG

                                      Create. Review. Publish.

                                      Write, edit, collaborate on, and publish documents to different content management platforms.

                                      Get Started Now




                                                        You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                                            Manage your brands on social media


                                                              • Desk Community Learning Series


                                                              • Digest


                                                              • Functions


                                                              • Meetups


                                                              • Kbase


                                                              • Resources


                                                              • Glossary


                                                              • Desk Marketplace


                                                              • MVP Corner


                                                              • Word of the Day


                                                              • Ask the Experts


                                                                Zoho Sheet Resources

                                                                 

                                                                    Zoho Forms Resources


                                                                      Secure your business
                                                                      communication with Zoho Mail


                                                                      Mail on the move with
                                                                      Zoho Mail mobile application

                                                                        Stay on top of your schedule
                                                                        at all times


                                                                        Carry your calendar with you
                                                                        Anytime, anywhere




                                                                              Zoho Sign Resources

                                                                                Sign, Paperless!

                                                                                Sign and send business documents on the go!

                                                                                Get Started Now




                                                                                        Zoho TeamInbox Resources





                                                                                                  Zoho DataPrep Demo

                                                                                                  Get a personalized demo or POC

                                                                                                  REGISTER NOW


                                                                                                    Design. Discuss. Deliver.

                                                                                                    Create visually engaging stories with Zoho Show.

                                                                                                    Get Started Now









                                                                                                                        • Related Articles

                                                                                                                        • Auto populate a field based on the selection from a lookup dropdown

                                                                                                                          Requirement   When a value is chosen from a lookup dropdown, related values are populated in the other fields of the same form. Use Case   An order management app contains a form to store order details. When the admin chooses the customer name from ...
                                                                                                                        • Auto-populate subform data from a form based on lookup selection

                                                                                                                          Requirements Streamline the process of retrieving and displaying relevant data by auto-populating a subform based on the value selected in a lookup field. Use Case Consider an IT asset management application used by organizations to conduct asset ...
                                                                                                                        • Auto-calculating values on a subform's field

                                                                                                                          Requirement Perform statistical operations on the numerical fields in subforms for analysis. Use Case  In an order management application, there are two forms, Order and Product. The Product form lists all the products in the inventory and the Order ...
                                                                                                                        • Dynamically Display Images in Pages

                                                                                                                          Requirement Dynamically display an image stored in the form in the Zoho Creator page. Use Case Imagine a Zoho Creator task management application employed to oversee tasks within an organization. Within the Dashboard page of this application, ...
                                                                                                                        • Dynamically Filter Lookup Options Based on Another Lookup Field's Selection

                                                                                                                          Requirement Automate the creation of portal user accounts based on the email entered in the Zoho Creator form. Use Case Consider an IT asset management application on which an organization relies to register and monitor assets assigned to employees. ...
                                                                                                                          Wherever you are is as good as
                                                                                                                          your workplace

                                                                                                                            Resources

                                                                                                                            Videos

                                                                                                                            Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                            eBooks

                                                                                                                            Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                            Webinars

                                                                                                                            Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                            CRM Tips

                                                                                                                            Make the most of Zoho CRM with these useful tips.



                                                                                                                              Zoho Show Resources