Branching Statements

Branching Statements

Return Type: Return type is the data type specifier of the data returned by the function. If no data is returned by the function, the return type must be specified as void.

Example 1: For AddRelatedList

  1. string getMySaasuData(string email)
  2. {
  3. contactResp =
  4. getUrl("https://secure.saasu.com/webservices/rest/r1/ContactList?wsaccesskey=
  5. CA497&fileuid=37863&SearchFieldName=EmailAddress&searchfieldnamebeginswith="
  6. + input.email);
  7. contactStr = contactResp.executeXPath("/contactListResponse/contactList/contactListItem");
  8. responseXML="";
  9. lastModifiedTime='01-Jan-1901 00:00:00';
  10. contactId="";
  11. rowCount=1;
  12. if((contactStr  !=  null)  &&  (contactStr  !=  ""))
  13. {
  14. responseXML="";
  15. contactList=contactStr.toList("-|-");
  16. for each contact in contactList
  17. {
  18. time=(contact.executeXPath("/contactListItem/utcLastModified/text()")).replaceAll("T"," ");
  19. dt=time.toTime("yyyy-MM-dd hh:mm:ss");
  20. if(dt  >  lastModifiedTime)
  21. {
  22. lastModifiedTime=dt;
  23. contactId = contact.executeXPath("/contactListItem/contactUid/text()");
  24. }
  25. }
  26. resp =
  27. getUrl("https://secure.saasu.com/webservices/rest/r1/invoicelist?wsaccesskey=CA497&fileuid=37863
  28. &transactiontype=s&contactUid="
  29. + contactId);
  30. invoicesList=resp.executeXPath("/invoiceListResponse/invoiceList/invoiceListItem").toList("-|-");
  31. info "invoicesList ::: " + invoicesList;
  32. for each invoice in invoicesList
  33. {
  34. invoiceUID = invoice.executeXPath("/invoiceListItem/invoiceUid/text()");
  35. invoiceNumber = invoice.executeXPath("/invoiceListItem/invoiceNumber/text()");
  36. invoiceDate = invoice.executeXPath("/invoiceListItem/invoiceDate/text()");
  37. dueDate = invoice.executeXPath("/invoiceListItem/dueDate/text()");
  38. totalAmount = invoice.executeXPath("/invoiceListItem/totalAmountInclTax/text()");
  39. responseXML=responseXML + "";
  40. responseXML=responseXML + "" + invoiceUID + "";
  41. responseXML=responseXML + "" + invoiceNumber + "";
  42. responseXML=responseXML + "" + invoiceDate + "";
  43. responseXML=responseXML + "" + dueDate + "";
  44. responseXML=responseXML + "" + totalAmount + "";
  45. responseXML=responseXML + "";
  46. rowCount=(rowCount  +  1);
  47. }
  48. responseXML=responseXML + "
  49. }
  50. else
  51. {
  52. responseXML=responseXML + "";
  53. responseXML=responseXML + "No Invoices found for this Contact";
  54. responseXML=responseXML + "";
  55. }
  56. return responseXML;
  57. }

The custom function mentioned above will return an xml response in a tabular form.

Example2: For CustomButton

  1. string Untitled_Function35 (map potential)
  2. {
  3. acquisitionDealId=input.potential.get("POTENTIALID");
  4. potDetails = zoho.crm.getRecordById("Ptentials",acquisitionDealId.toLong());
  5. potName=potDetails.get("Potential Name");
  6. currency=potDetails.get("Currency");
  7. mp=map();
  8. mp.put("Subject",potName + " - Follow Up");
  9. mp.put("SEID",acquisitionDealId);
  10. mp.put("SEMOUDLE","Potentials");
  11. mp.put("Currency",currency);
  12. createresp=zoho.crm.create("Tasks",mp);
  13. return "Task Created Successfully";
  14. }

    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








                                    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

                                                                                                      • Control Statements

                                                                                                        Overview A program consists of a number of statements which are usually executed in sequence. Programs can be much more powerful if we can control the order in which statements are run. To achieve this, deluge script offers developers the if,else ...
                                                                                                      • Conditional Statements

                                                                                                        This guide will help you with the following: 1. Overview 2. Syntax 3. Examples Overview Conditional statements examine specified criteria, and act in one way if the criteria are met, or in another way if the criteria are not met. The criteria is ...
                                                                                                      • Criteria in conditional statements

                                                                                                        This guide will help you with the following: Overview Syntax Example Applicable operators and expressions for TEXT expressions Applicable operators and expressions for NUMBER and Decimal expressions Applicable operators and expressions for DATE-TIME ...
                                                                                                      • Assignment Statements

                                                                                                        Overview An assignment statement in Deluge uses the assignment operator (=) to assign the result of an expression to a variable. Syntax variable = expression;   Compound Assignment Operators A compound assignment operator is an operator that performs ...
                                                                                                      • Debug Statements

                                                                                                        Description The info keyword is used in Validate, Success or Update actions to display debug messages to assist an app owner in debugging the application. The info message can be viewed only by the owner of the application by clicking on the ...
                                                                                                        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