Welcome to Portal

?Unknown\pull-down

Welcome to Zoho Cares

Bienvenido a Soporte de Zoho

Search our knowledge base, ask the community or submit a request.

Hello Everyone,

A Custom function is a user-written set of code to achieve a specific requirement. Set the required conditions needed as when to trigger using the Workflow rules (be it Tasks / Project) and associate the custom function to it.

Requirement:-

One of our customers would like to start / pause / stop the the timer based on below status update for the Task.

Task status - In Progress - Start the timer.

Task status - hold - Pause the timer.

Task status - closed - Stop the timer.

Above requirement can be implemented using Task custom functions along with Workflow rules in Zoho Projects.

Custom function code:-


// TODO: Please create a connection for the Zoho Projects service with the scopes scopes: ZohoProjects.tasks.ALL,ZohoProjects.Timesheet.ALL
Click this link below to learn how to create the connection.


endPoint = "https://projectsapi.zoho.com/restapi/portal/";

if(equalsIgnoreCase(statusValue,"In progress"))

{
startTimerResponse = invokeurl
[

url :endPoint + portalId + "/projects/" + projectId + "/tasks/" + taskId + "/timer/?action=start"

type :POST
connection:"xxxxxx"

];

}

if(equalsIgnoreCase(statusValue,"hold"))

{

pauseTimerResponse = invokeurl

[

url :endPoint + portalId + "/projects/" + projectId + "/tasks/" + taskId + "/timer/?action=pause"

type :POST

connection:"xxxxxx"

];

}

if(equalsIgnoreCase(statusValue,"closed"))

{

stopTimerResponse = invokeurl

[

url :endPoint + portalId + "/projects/" + projectId + "/tasks/" + taskId + "/timer/?action=stop&approver=" + actionperformerId

type :POST

connection:"xxxxxx"

];

}

return "success";

Make sure to replace xxxxxx with the Zoho Projects connections link name. Screenshot of the list of parameters to be mapped and sample Task workflow rule is attached for reference.

We hope you found this post useful. If you have any questions or wondering if your requirement could be met using custom functions, feel free to share them in the comments section below.

 

 

 


Attachments
Arguments.png
Arguments.png352 KB
Workflow rule.png
Workflow rule.png438 KB
3 users like this announcement.
4 Replies
Reply
  • 1 month ago

Hi Saraswathi 

I have implemented this script with all the connections and added it to the workflow and blueprints, and for some reason, it still does not work. Wondered if you could cast your eye over this 

if(equalsIgnoreCase(statusValue,"In progress"))
{
startTimerResponse = invokeurl
[
url :endPoint + portalId + "/projects/" + projectId + "/tasks/" + taskId + "/timer/?action=start"
type :POST
connection:"zohoprojectsallconnections"
];
}
if(equalsIgnoreCase(statusValue,"On Hold"))
{
pauseTimerResponse = invokeurl
[
url :endPoint + portalId + "/projects/" + projectId + "/tasks/" + taskId + "/timer/?action=pause"
type :POST
connection:"zohoprojectsallconnections"
];
}
if(equalsIgnoreCase(statusValue,"Complete"))
{
stopTimerResponse = invokeurl
[
url :endPoint + portalId + "/projects/" + projectId + "/tasks/" + taskId + "/timer/?action=stop&approver=" + actionperformerId
type :POST
connection:"zohoprojectsallconnections"
];
}
return "success";



Dear Hallam, 

We would like to check the reported issue in your portal. I have also sent an email requesting your available time slots for further assistance. 

You can reach us via email at
support@zohoprojects.com for any other queries or updates.

Regards, 
Saraswathi.

  • 1 month ago

Hi Saraswathi,

Good day! I have implemented this in our portal and added the connection, but it doesn't seem to be working. Could you kindly look into this and assist? Your help would be greatly appreciated.


if(equalsIgnoreCase(statusValue,"In progress"))
{
startTimerResponse = invokeurl
[
url :endPoint + portalId + "/projects/" + projectId + "/tasks/" + taskId + "/timer/?action=start"
type :POST
connection:"zohoproject"
];
}
if(equalsIgnoreCase(statusValue,"On hold"))
{
pauseTimerResponse = invokeurl
[
url :endPoint + portalId + "/projects/" + projectId + "/tasks/" + taskId + "/timer/?action=pause"
type :POST
connection:"zohoproject"
];
}
if(equalsIgnoreCase(statusValue,"closed"))
{
stopTimerResponse = invokeurl
[
url :endPoint + portalId + "/projects/" + projectId + "/tasks/" + taskId + "/timer/?action=stop&approver=" + actionperformerId
type :POST
connection:"zohoproject"
];
}
return "success";

Dear Jun,

Please verify that the status you are using in your portal, such as "In Progress" or "On Hold," aligns with what is specified in the code, including both the workflow criteria and the task status.

Additionally, ensure that the appropriate scopes were selected when creating the connection.

If the issue persists, kindly share your available time slots for a brief screen share session. You can send the details to support@zohoprojects.com and we will assist you in troubleshooting further.

Regards,
Saraswathi.


Reply to Saraswathi SA
/* */
  • 12
  • Insert
  • Plain text
Add Comment
(Up to 20 MB )