For Zoho Services only:


I'm actually part of something bigger at Ascent Business Solutions recognized as the top Zoho Premium Solutions Partner in the United Kingdom.

Ascent Business Solutions offer support for smaller technical fixes and projects for larger developments, such as migrating to a ZohoCRM.  A team rather than a one-man-band is always available to ensure seamless progress and address any concerns. You'll find our competitive support rates with flexible, no-expiration bundles at http://ascentbusiness.co.uk/zoho-support-2.  For larger projects, check our bespoke pricing structure and receive dedicated support from our hands-on project consultants and developers at http://ascentbusiness.co.uk/crm-solutions/zoho-crm-packages-prices.

The team I manage specializes in coding API integrations between Zoho and third-party finance/commerce suites such as Xero, Shopify, WooCommerce, and eBay; to name but a few.  Our passion lies in creating innovative solutions where others have fallen short as well as working with new businesses, new sectors, and new ideas.  Our success is measured by the growth and ROI we deliver for clients, such as transforming a garden shed hobby into a 250k monthly turnover operation or generating a +60% return in just three days after launch through online payments and a streamlined e-commerce solution, replacing a paper-based system.

If you're looking for a partner who can help you drive growth and success, we'd love to work with you.  You can reach out to us on 0121 392 8140 (UK) or info@ascentbusiness.co.uk.  You can also visit our website at http://ascentbusiness.co.uk.

Zoho Creator: Two submit buttons on a non-stateless form with 2 different redirects

What?
This is an article to document how to have two submit buttons on a non-stateless form which both submit the form but one leaves the current record open while the other redirects to the reports view.

Why?
A client wanted a "Save" button on their form as well as a "Save & Close" button. The "Save" button would submit the form but keep the user on the record form. The "Save & Close" button would submit the form and then redirect the user to the report view of the records.

Zoho Creator: Two submit buttons on a non-stateless form: Result

Sounds simple but you can only set a form to redirect to one link and adding a HTML anchor link (<a href>) to the page won't help as you need to submit the form before redirecting the user.  A HTML <input type=submit> element to the page won't help either as you need to redirect the user to the specified report after submitting the form.

How?
Well as always, I'm going to cheat. My solution here was to simply repurpose a decision box field in Creator; then re-style it to look like a button; then add a workflow on click of this field.

  1. Set the form to reload the existing record when it is submitted (either on "Successful form submission", or on properties "On Successful Submission" > "Direct To", or my favorite, Deluge "openUrl()"). Standard as for any usual form without a redirect.
  2. Drag a decision box field on to the form; we are calling ours "Save & Close" with the field link name as "Save_and_Close" (the field link name is important for the next step: CSS styling):
    Zoho Creator: Two submit buttons on a non-stateless form: Decision Box field
  3. Apply the following styling (this will depend on the theme you are using):
    copyraw
    <style>
    		.zc-Save_and_Close-group .decision-box-field label{
    			display:none !important;
    		}
    		.zc-Save_and_Close-group label{
    			cursor:pointer;
    			outline:none;
    			text-align:center !important;
    			white-space:nowrap;
    			line-height:19px;
    			height:31px;
    			background-color: #6B47F4;
    			color:#fff !important;
    			font-weight: 400 !important;
    			font-size: 14px !important;
    			padding:7px !important;
    			box-shadow: 0 3px 8px 0 rgb(107 71 244 / 33%);
    			border-radius:5px;
    			width:100px;
    			max-width: 100px !important;
    			min-width: 100px !important;
    			float: right !important;
    			margin-right: 40px !important;			
    		}
    		.zc-Save_and_Close-group label:hover{
    			background-color: #613DEA;
    		}
    </style>
    1.  <style> 
    2.          .zc-Save_and_Close-group .decision-box-field label{ 
    3.              display:none !important; 
    4.          } 
    5.          .zc-Save_and_Close-group label{ 
    6.              cursor:pointer; 
    7.              outline:none; 
    8.              text-align:center !important; 
    9.              white-space:nowrap; 
    10.              line-height:19px
    11.              height:31px
    12.              background-color: #6B47F4; 
    13.              color:#fff !important; 
    14.              font-weight: 400 !important; 
    15.              font-size: 14px !important; 
    16.              padding:7px !important; 
    17.              box-shadow: 0 3px 8px 0 rgb(107 71 244 / 33%)
    18.              border-radius:5px
    19.              width:100px
    20.              max-width: 100px !important; 
    21.              min-width: 100px !important; 
    22.              float: right !important; 
    23.              margin-right: 40px !important; 
    24.          } 
    25.          .zc-Save_and_Close-group label:hover{ 
    26.              background-color: #613DEA; 
    27.          } 
    28.  </style> 
  4. In Workflow > Form workflows > Click on "New Workflow"
    1. Choose your form
    2. Run when a record is "Created or Edited"
    3. When to trigger workflow is "User input of a field"
    4. Choose Field "Save & Close"
    5. Name the workflow "OnSubmit_SaveClose"
      Zoho Creator: Two submit buttons on a non-stateless form: Workflow
    6. Add your deluge code that should:
      • Validate the fields (checks mandatory fields have been entered) for example:
        copyraw
        //
        // check mandatory fields have been entered
        l_Errors = List();
        if(isnull(input.Record_Name))
        {
        	l_Errors.add("- Record Name");
        }
        if(l_Errors.size() > 0)
        {
        	alert "Please enter the following required fields:\n" + l_Errors.toString("\n");
        }
        else
        {
        	// ... code to submit form/save to record here
        }
        1.  // 
        2.  // check mandatory fields have been entered 
        3.  l_Errors = List()
        4.  if(isnull(input.Record_Name)) 
        5.  { 
        6.      l_Errors.add("- Record Name")
        7.  } 
        8.  if(l_Errors.size() > 0) 
        9.  { 
        10.      alert "Please enter the following required fields:\n" + l_Errors.toString("\n")
        11.  } 
        12.  else 
        13.  { 
        14.      // ... code to submit form/save to record here 
        15.  } 
      • Then save the data by adding the record or updating the existing record
        copyraw
        if(!isnull(input.ID))
        {
        	// ... code to update existing record
        	r_Details = myForm[ID == input.ID];
        	r_Details.Account = input.Account.toLong();
        }
        else
        {
        	// ... code to create new record
        	r_NewRecord = insert into <formname>
        	[
        		<fieldname1> = <expression>
        		<fieldname2> = <expression>
        		<fieldname3> = <expression>
        	];
        }
        1.  if(!isnull(input.ID)) 
        2.  { 
        3.      // ... code to update existing record 
        4.      r_Details = myForm[ID == input.ID]
        5.      r_Details.Account = input.Account.toLong()
        6.  } 
        7.  else 
        8.  { 
        9.      // ... code to create new record 
        10.      r_NewRecord = insert into <formname> 
        11.      [ 
        12.          <fieldname1> = <expression> 
        13.          <fieldname2> = <expression> 
        14.          <fieldname3> = <expression> 
        15.      ]
        16.  } 
  5. Done:
    Zoho Creator: Two submit buttons on a non-stateless form: Result

Additional
  • Remember that an integration field on the interface is returned as a string and needs to be converted to a number to be assigned, eg:
    copyraw
    r_Details = myForm[ID == 1234567980123456789];
    r_Details.Account = input.Account.toLong();
    1.  r_Details = myForm[ID == 1234567980123456789]
    2.  r_Details.Account = input.Account.toLong()
Category: Zoho :: Article: 754

Credit where Credit is Due:


Feel free to copy, redistribute and share this information. All that we ask is that you attribute credit and possibly even a link back to this website as it really helps in our search engine rankings.

Disclaimer: Please note that the information provided on this website is intended for informational purposes only and does not represent a warranty. The opinions expressed are those of the author only. We recommend testing any solutions in a development environment before implementing them in production. The articles are based on our good faith efforts and were current at the time of writing, reflecting our practical experience in a commercial setting.

Thank you for visiting and, as always, we hope this website was of some use to you!

Kind Regards,

Joel Lipman
www.joellipman.com

Related Articles

Joes Revolver Map

Joes Word Cloud

Accreditation

Badge - Certified Zoho Creator Associate
Badge - Certified Zoho Creator Associate

Donate & Support

If you like my content, and would like to support this sharing site, feel free to donate using a method below:

Paypal:
Donate to Joel Lipman via PayPal

Bitcoin:
Donate to Joel Lipman with Bitcoin bc1qf6elrdxc968h0k673l2djc9wrpazhqtxw8qqp4

Ethereum:
Donate to Joel Lipman with Ethereum 0xb038962F3809b425D661EF5D22294Cf45E02FebF
© 2024 Joel Lipman .com. All Rights Reserved.