Download a employee's salary structure with watermark | Zoho Creator Academy

Download a employee's salary structure with watermark

Requirement

Create a template that has a watermark using the pages component in Creator. On click of a custom button, your application's users will be able to download their data populated on the template.

Use Case

A software company uses an Employee Management application to perform various employee related operations including maintaining their payroll.  Employees will have access to their Salary Structure report. If they wish to download their salary structure, they can simply click the Download button that will be available next to each record. The salary structure will be downloaded to their local drive in the designed format with the company's logo added as a watermark.

Steps to follow

1. Create 3 forms with the following details:

Form

Form Link Name

Field Type

Field Name

Field Link Name

Add Organization

Add_Organization

Single Line

Organization Name

Organization_Name

Image

Logo

Logo

Phone

Phone Number

Phone_Number

Address

Address

Address

Add Employee

Add_Employee

Name

Name

Name

Phone

Mobile Number

Mobile_Number

Email

Official Email

Official_Email

Number

Employee ID

Employee_ID

Single Line

Department

Department

Single Line

Designation

Designation

Single Line

Date of Joining

Date_of_Joining

Salary Structure

Salary_Structure

Lookup
(Add_Employee form)

Employee

Employee

Dropdown

(Imported with predefined choices - Months of the year)

Month

Month_field

Currency

Basic

Basic

Currency

HRA

HRA

Currency

Allowance

Allowance

Currency

PF

PF

Currency

CTC

CTC


2. Create a page named Download Salary Structure and add a page parameter named recid.

3. Include an HTML snippet block into it. We'll use this HTML snippet block to design the salary structure template. 



4. Save the following snippets into the block to create an HTML template based on which the salary structure needs to be downloaded. This snippet also adds the organization logo as watermark to the template.
Prerequisite:
  1. Publish the All_Organizations report (which contains the organization logo) and get the <publish_key>. The publish key of the report is available in the generated perma link.
  2. Example: In the following permalink, 9rxBB4eTWwxXqgB4OsZtTeHsuk9O71WhNXYWVdm3M82PHHSeOTz4kf2QwTGYdC1FVanO1uUFahNZk0fKDOWZtOAqDbyvSm7PnGN2 is the publish key i.e., the set of characters that follow the component name in the URL.
    Permalinkhttps://creatorapp.zohopublic.com/zylker100122/employee-management/form-perma/Add_Organization/9rxBB4eTWwxXqgB4OsZtTeHsuk9O71WhNXYWVdm3M82PHHSeOTz4kf2QwTGYdC1FVanO1uUFahNZk0fKDOWZtOAqDbyvSm7PnGN2

i. Fetch required values from the Salary Structure, Add employee, and Add Organization forms.
  1. <%{
  2. salary_rec = Salary_Structure[ID == recid.toLong()];
  3. org_rec = Add_Organization[ID != 0];
  4. employee_rec = Add_Employee[ID == salary_rec.Employee];
ii. Construct the image download URL for the company's logo that is stored in Add Organization form. This image will be added as the watermark.
  1. imageurl = org_rec.Logo.executeXPath("/img/@medqual").executeXPath("/medqual/text()");
  2. fileID = imageurl.subString(imageurl.lastIndexOf("/")+1, imageurl.length());
  3. info fileID;
  4. // Replace <user_name>, <application_link_name>, and <publish_key> with appropriate values.
  5. image = "https://creator.zoho.com/file/<user_name>/<application_link_name>/All_Organizations/"+org_rec.ID+"/Logo/image-download/<publish_key>?filepath=/"+fileID;
  6. %>
iii. Define watermark style using CSS.
  1. <style>
  2. #watermark
  3.     {
  4. position: absolute;
  5.     opacity: 0.3;
  6.     text-align: center;
  7.     height: 100%;
  8.     width: 100%;
  9.     box-sizing: border-box;
  10.     }
  11. #watermark img
  12. {
  13.     transform: translateY(100%);
  14. }
  15. </style>
iv. Construct the template using HTML. 
Note: The following snippet constructs a very basic template. You can customize this based on your requirements.
  1. <div id="watermark"><img src="<%=image%>"></div>
  2. <div style="padding:20px 40px">
  3. <div ><center> <b style="font-size: 25px;"><%=org_rec.Organization_Name%></b></center><br>
  4. <div style="font-size: 15px;color: #515151;word-break: initial;display:inline">
  5. <center><%=org_rec.Address%><br />Phone: <%=org_rec.Phone_Number%></center></div>
  6. </div>
  7. <p><b style="font-size: 20px;">CTC structure for the month of <%=salary_rec.Month_field%></b> <br></p>
  8. <div>  <b>Employee ID: </b><%=employee_rec.Employee_ID%> </div>
  9. <div>  <b>Name: </b><%=employee_rec.Name%> </div>
  10. <div>  <b>Email: </b><%=employee_rec.Official_Email%> </div>
  11. <div>  <b>Department: </b><%=employee_rec.Department%> </div>
  12. <div>  <b>Designation: </b><%=employee_rec.Designation%> </div>
  13. <div>  <b>Date Of Joining: </b><%=employee_rec.Date_of_Joining%> </div>
  14.    <p><br></p>
  15. <div>  <b>Basic: </b><%=salary_rec.Basic%> </div>
  16. <div>  <b>HRA: </b><%=salary_rec.HRA%> </div>
  17. <div>  <b>Allowance: </b><%=salary_rec.Allowance%> </div>
  18. <div>  <b>PF: </b><%=salary_rec.PF%> </div>
  19.    <p><br></p>
  20. <div>  <b>Monthly CTC: </b><%=salary_rec.CTC%> </div>
  21. </div>
  22. <%
  23. }%>
5. Salary structure of all the employees  are maintained in the All_Salary_Structure report. However, admin can view and access all the reports and employees should be able to view and download only their records. To achieve this, go to the Design tab of All Salary Structure report and click Open Report Properties button.



6. Click Filters under Organized Records and add the following criteria.



7. Now, let's add a custom button to the All_Salary_Structure report. Click the Layout tab under Quick View in the Report Customization - Web. 



8. Click +Add Fields, scroll down and click +Add New Button under Buttons.



 9. Provide the following details and click Create Workflow.



10. Click Add New Action > Deluge Script > Create your own, and add the following snippet:
  1. // Replace <user_name> and <application_link_name> with appropriate values.
  2. openUrl("https://creatorapp.zoho.com/export/<user_name>/<application_link_name>/pdf/Download_Salary_Structure?recid=" + input.ID,"new window");
The snippet uses the openURL task to open the Download Salary Structure page. The data of the current record will be populated in the HTML template we added (in the 4th step) to Download Salary Structure page. 

11. The Download Salary Structure page is meant to be used only as a template while downloading the salary structure. Therefore, hide the page using sections so the users will not be able to access it while accessing the application.

12. Add the employees as users of the application for them to access the All Salary Structure report and download the Download Salary Structure page.

See how it works


Points to note

  1. This tutorial assumes the app is created in .com DC. To use the same script in different DCs, change the URLs in step 4.ii and step 10 accordingly.
  2. The Organization Details report needs to be published in order to use the logo image stored in it as a watermark in the file that will be downloaded.
  3. Make sure the employee has access to both All Salary structure report and Download Salary structure page.
  1. Pages
  2. openURL task
  3. Add users
  4. Custom Action
  5. Filters

    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 Links Workflow Automation Data Collection
                          Web Forms Enterprise Begin Data Collection
                          Interactive Forms Workplace Data Collection App
                          CRM Forms Customer Service Accessible Forms
                          Digital Forms Marketing Forms for Small Business
                          HTML Forms Education Forms for Enterprise
                          Contact Forms E-commerce Forms for any business
                          Lead Generation Forms Healthcare Forms for Startups
                          Wordpress Forms Customer onboarding Order Forms for Small Business
                          No Code Forms Construction RSVP tool for holidays
                          Free Forms Travel
                          Prefill Forms Non-Profit

                          Intake Forms Legal
                          Mobile App
                          Form Designer HR
                          Mobile Forms
                          Card Forms Food Offline Forms
                          Assign Forms Photography
                          Mobile Forms Features
                          Translate Forms Real Estate Kiosk in Mobile Forms
                          Electronic Forms

                          Notification Emails for Forms Alternatives Security & Compliance
                          Holiday Forms Google Forms alternative  GDPR
                          Form to PDF Jotform alternative HIPAA Forms
                          Email Forms
                          Encrypted Forms
                          Embeddable Forms
                          Secure Forms
                          Drag and Drop form builder
                          WCAG


                                            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

                                                  Zoho Desk Resources

                                                  • Desk Community Learning Series


                                                  • Digest


                                                  • Functions


                                                  • Meetups


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner


                                                  • Word of the Day


                                                    Zoho Marketing Automation

                                                      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 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

                                                                                                              • Disable Custom Actions after n times

                                                                                                                Requirement  A custom action on a report has to be disabled after it is triggered three times. Use Case  We have an app to maintain customer invoices. After an invoice is created, the staff can email the invoice to the customer with the click of a ...
                                                                                                              • Display custom action button for specific records

                                                                                                                Requirement   The custom action button in a report should be visible only for certain records, based on a condition. Use Case   An asset request app lets employees raise requests for gadgets or machines. While filling the form, employees can specify ...
                                                                                                              • Publish to Marketplace

                                                                                                                Requirement Publish a custom app in Marketplace. Use Case A care-taking facility wants to search for appropriate caregivers to the patients in the same postal code. They have built an application that will help everyone during an emergency. Now, they ...
                                                                                                              • Automatically create daily reports and send current day's reports as email attachment

                                                                                                                Requirement Schedule custom actions to automatically create labour reports everyday at the specified time and send a filtered report of all the reports corresponding to the current day as an email attachment. Use case Let's assume your company has ...
                                                                                                              • Building an employee dashboard

                                                                                                                Requirement Create an employee dashboard with buttons that will help the employees to check in and out, find the total number of logged-in hours and apply for leave. Use Case An Employee Management application has a dashboard for their employees. As ...
                                                                                                                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