Using Cliq forms to add a task in Projects

Using Cliq forms to add a task in Projects

Forms in Cliq are platform components that can take in multiple user inputs in a single go, standardize the way work gets kicked off in an organization and helps you automate your everyday workflow. 
Let's understand forms better by considering the following scenario.

Scenario
 
Assume, your team is now working on a new project and your lead decides to assign the tasks to the concerned person in Zoho Projects. As a first step, let's connect Zoho Projects with Cliq and add tasks right from the Cliq window using forms. To do this,
 
1. Connect Cliq with Zoho Projects by giving your connection a name followed by specifying the scopes. 
2.  The scopes required to add a task in Zoho Projects are,
  •  ZohoProjects.portals.READ
  •  ZohoProjects.projects.READ
  •  ZohoProjects.users.READ
  • ZohoProjects.tasks.CREATE
3. The required method is POST and the URL to connect Zoho Projects with Cliq is 
https://projectsapi.zoho.com/restapi/portal/[PORTALID]/projects/[PROJECTID]/tasks/

4. Once after you initiate the connection use the deluge code generated, in your script.

5. To know more about the scopes available in Zoho Projects head on over here.
 
The bots menu handler and form submit handler code to add a task in Zoho Projects is attached here. Try copying the code in your deluge editor and execute it.

Bot menu handler code
  1. response = Map();
  2. inputs = list();
  3. inputs.add({"type":"text","name":"taskname","label":"Task Name","placeholder":"Specify the task name","mandatory":true,"value":"Enter the task name here"});
  4. inputs.add({"type":"textarea","name":"desc","label":"Add Description","placeholder":"A small description of the task","mandatory":false,"value":"A small description about the task"});
  5. inputs.add({"type":"date","name":"startdateinfo","label":"Start Date","placeholder":"01-01-2020","mandatory":false});
  6. inputs.add({"type":"date","name":"duedateinfo","label":"Due Date","placeholder":"01-01-2020","mandatory":false});
  7. inputs.add({"type":"select","name":"prior","label":"Priority","placeholder":"None","mandatory":false,"value":"None","options":[{"label":"None","value":"none"},{"label":"High","value":"high"},{"label":"Medium","value":"medium"},{"label":"Low","value":"low"}]});
  8. por = invokeurl
  9. [
  10. url :"https://projectsapi.zoho.com/restapi/portals/"
  11. type :GET
  12. connection:"Your connection name"
  13. ];
  14. portals = por.get("portals");
  15. user_listing=Collection();
  16. for each portal in portals
  17. {
  18. id = portal.get("id_string");
  19. pro = invokeurl
  20. [
  21. url :"https://projectsapi.zoho.com/restapi/portal/" + id + "/projects/"
  22. type :GET
  23. connection:"Your connection name"
  24. ];
  25. projects = pro.get("projects");
  26. for each project in projects
  27. {
  28. pid = project.get("id_string");
  29. users = invokeurl
  30. [
  31. url :"https://projectsapi.zoho.com/restapi/portal/"+id+"/projects/"+pid+"/users/"
  32. type : GET
  33. connection:"Your connection name"
  34. ];
  35. for each user in users.get("users")
  36. {
  37. user_id=user.get("id");
  38. user_name=user.get("name");
  39. user_listing.insert({"label":user_name,"value":user_id});
  40. }
  41. }
  42. }
  43. inputs.add({"type":"select","max_selections":"2","multiple":true,"name":"assignee","label":"Owner","placeholder":"Add a user","mandatory":true,"value":"Olivia","options":user_listing});
  44. form = {"type":"form","title":"New Task","hint":"Add a new task in Projects","name":"addtasks","version":1,"button_label":"Add","action":{"type":"invoke.function","name":"tasks"},"inputs":inputs};
  45. return form;
 Form submit handler code
  1. response = Map();
  2. param = Map();
  3. formValues = form.get("values");
  4. priority = formValues.get("priority");
  5. param.put("name",formValues.get("taskname"));
  6. param.put("description",formValues.get("desc"));
  7. param.put("start_date",formValues.get("startdateinfo").toString("MM-dd-yyyy"));
  8. param.put("end_date",formValues.get("duedateinfo").toString("MM-dd-yyyy"));
  9. param.put("priority",formValues.get("prior").get("label"));
  10. param.put("person_responsible",(formValues.get("assignee").get("0").get("value")).toString());
  11. por = invokeurl
  12. [
  13. url :"https://projectsapi.zoho.com/restapi/portals/"
  14. type :GET
  15. connection:"Your connection name"
  16. ];
  17. portals = por.get("portals");
  18. for each portal in portals
  19. {
  20. id = portal.get("id_string");
  21. pro = invokeurl
  22. [
  23. url :"https://projectsapi.zoho.com/restapi/portal/" + id + "/projects/"
  24. type :GET
  25. connection:"Your connection name"
  26. ];
  27. user_listing_map = Map();
  28. projects = pro.get("projects");
  29. for each project in projects
  30. {
  31. pid = project.get("id_string");
  32. tasks = invokeurl
  33. [
  34. url :"https://projectsapi.zoho.com/restapi/portal/" + id + "/projects/" + pid + "/tasks/"
  35. type :POST
  36. parameters:param
  37. connection:"Your connection name"
  38. ];
  39. }
  40. }
  41. return {"text":"Hurray! Successfully added a task in Projects :happy:"};




With a multitude of possibilities available with forms, Zoho Cliq let's you build dynamic forms using a form builder. A form builder in Cliq is a form building platform for non coders to build interactive forms easily.
Here's a small video on building a form using the form builder.



There you go! A small example to understand how forms can come in handy to get your works done on the go. In case of any doubts or queries, do comment below. We'd be happy to assist you.

Regards,
Divya P
Zoho Cliq





    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation
                                              • Sticky Posts

                                              • Convert a message on Cliq into a task on Zoho Connect

                                                Message actions in Cliq are a great way to transform messages in a conversation into actionable work items. In this post, we'll see how to build a custom message action that'll let you add a message as a task to board on Zoho Connect. If you haven't created
                                              • Cliq Bots - Post message to a bot using the command line!

                                                If you had read our post on how to post a message to a channel in a simple one-line command, then this sure is a piece of cake for you guys! For those of you, who are reading this for the first time, don't worry! Just read on. This post is all about how
                                              • Cliq Bots - How to make a bot respond to your messages?

                                                Bots are just like your buddies with whom you can interact. They carry out your tasks, keep you notified about your to-dos and come in handy when you need constant updates from a third party application.  So, how can you make your bot respond to a message? The bot message handler is a piece of code triggered when a message is sent to the bot. Message handlers help you customise your bot responses to make it look conversational. The message input from the user can be either a string or an option selected
                                              • Cliq Bots - Get notifications about any action on an application with the incoming webhook handler!

                                                Webhooks can be used to get notified about events happening in other applications inside Cliq. All bots in Cliq have their own incoming webhook endpoint. This makes it simple to post messages to the bot from external applications. Unlike the send message
                                              • The Slash Command Series - Types of Command Suggestions

                                                Hi Everybody! I hope you guys tried the /zdocs command and now have an idea of how command suggestions with click to execute work. If you have no clue of what command suggestion is, I recommend you to take a look at all the Slash Command Series posts, especially the one on Command Suggestions ! This post is all about the different types of command suggestions.  Customise your command suggestions  Did you know you could customise your command suggestion list with a title, description, image? Well,


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns Resources


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • Functions

                                                                            Functions

                                                                          • Meetups

                                                                            Meetups

                                                                          • Kbase

                                                                            Kbase

                                                                          • Resources

                                                                            Resources

                                                                          • Digest

                                                                            Digest

                                                                          • CRM Marketplace

                                                                            CRM Marketplace

                                                                          • MVP Corner

                                                                            MVP Corner





                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now