How to transfer analytics from one task to another in Planfix
29.10.2021
Greetings!
Today I want to share a new way of transferring analysts from one problem to another. I had to tinker with the preparation of materials. Killed about 8 hours for all the research, but it was worth it.
One of the latest cases is a non-standard way of transferring analysts from one task to another.
The case is already published on the official Planfix blog. Administrators and integrators of the platform use the method, send examples of solving client problems.
And thank you for the good solution.
We decided to share the case with you. Let's start.
Stepan Cheltsov on the transfer of analysts from tasks to tasks
A discussion arose in the chat of Planfix enthusiasts, where a person tried to send analysts of one task to a super-task through Integromat , and he didn't succeed. I was attracted by the situation, because requests for this sometimes arose, I felt the possibility of implementation, but my hands did not reach. So, to the barrier.
We need:
- a process button or script for sending data to analysts;
- a webhook for receiving data;
- patience and savvy.
Webhook
First, let's prepare a webhook:
1. The type of request received is a POST request in JSON format.
2. Get the URL for the next step ...
3. Create a variable for the task with the only value. I have this task.
4. Create a variable for all analysts with a selection of all found values. I have this massiv [*].
5. Scroll and select the item" Change existing task ", which we will find by the task infoblock or where you have the task number.
6. Add a comment to it that will show the content of our request. I have two lines - {{Infoblock.task}} and {{Infoblock.massiv}}.
7. Save, do nothing more, continue further.
Analyst transfer script
The script looks like this:
1. Select the launch trigger, for me this is the process button, you can add a comment or change the status, or fill in the fields, etc.
2. Prepare an HTTP request to the webhook:
- specify the URL of the webhook;
- call the analytics array somehow in English (I have it massiv and, in general, all task analysts {{Task.All analysts.JSON}});
- we name the variable with the task number to which we will send the analysts (for me this is a task and a task number {{Task.Number }});
- Content-type specify application / json.
3. Save the script / button.
This was preliminary preparation, because we do not yet know what kind of analytics will arrive at you, or maybe more than one type will arrive. Let's first analyze a case with one analytic and some number of lines.
One analytics
Here is an example of my analytics. I placed it vertically on purpose so that it was convenient to count. And we will count the lines:
To parse an array of analysts, we need to understand the basic logic of working with arrays - they are calculated from zero, not one. We really need these numbers. That is:
- the line "Services" has number 0;
- the line "Specification" has number 1;
- continue on our own;
- the line "Acceptance Criterion" is number 11.
Let's go back to our webhook and make the following settings, like mine.
What's important to note here :
You might ask, since we're so smart, why are we adding a comment? Answer: because even an experienced developer will spend time looking for their mistakes, and they will definitely be. Such a comment at the debugging stage will help you understand if your infoblocks contain anything at all. And each time you will be more confident in figuring out where you screwed up.
Now let's scroll through our webhook and start adding analytics like mine.
What's important to do here :
Remark : if you have fields of the "Directory record" type, the task will be selected from the list by name. But if you have a field of the "Task" type, the first task with the same name that appears in ascending order will be selected by its name. Therefore, name the tasks with unique names.
Save our webhook and run the script. At first I got this:
I clearly saw the number, I twisted the array in my PyCharm'e, then brought out all the fields to check myself, it turned out better:
Well, my analysts were added correctly:
When you are finished with the settings, do not forget to delete the comment in the target task, we no longer need this for our daily work.
Several analysts
Now let's simulate a situation when you have several analysts in the source task:
And here's what came to me:
The data has been added, but it doesn't help me much. The result is garbage data. What can be done?
First of all, you need to understand for yourself that each analyst will have to make its own webhook, because the webhook does not check the conditions of the received values, it only sets them in the fields. Next, it is important to understand the context of events in which analytics appears. You can set up a trigger to add a comment that contains certain analytics:
Then send the analysts of the comment itself:
It is possible that your guys are editing the analytics attached to the task, they can also be taken separately. If there is only one kind of analyst, of course:
Why is all this necessary?
The practical use of such operations:
- People, information from their analysts is important to you in other places;
- You need to overtake the data of some analysts in other analytics, with a different name and essence. For example, a meeting of directors is an analyst of the meeting minutes, and the data is needed by financiers, managers and others in various analysts and tasks. Or you decided to change the logic of work, but you cannot delete the old analysts - there are reports and documents for them;
- In the supertask you have planned values, and in subtasks - actual values. They can be thrown to balance the indicators;
- You are moving from one account to another, or you need to work in conjunction for several accounts. According to this principle, we will transfer the actual time to the clients on Planfix support, whom we serve;
- Data may arrive not from Planfix, but now you can figure out how their land correctly.
If you want to understand deeper, come to mine workshops around Planfix.
And, of course, I'm ready to help Planfix consultations to anyone who needs it.