tomolimo / processmaker

GLPI plugin that provides an interface with ProcessMaker (http://www.processmaker.com/)
31 stars 11 forks source link

Approval of processmaker task over email in GLPI #82

Open rohit-ambre-uno opened 6 years ago

rohit-ambre-uno commented 6 years ago

Any idea how can we Approve/Reject any task from Email- As Approval tasks will get assign to any head user who will receive email notification about the task but will not login in GLPI to Approve the task instead he/she will send Email with ‘Approve’ or ‘Reject’ written in it, and that task will get completed and process will move onto next step. I know there are possibilities of email forging but consider it is handled. Can we achieve this by setting some value in GLPI by using business rules and then setting GET variables of processmaker plugin to use in PM server. Actually this feature is available in Enterprise version of processmaker. click on this link for some more documentation. I know you are integrating two applications with plugin so it gets more complex. I am also working on this, if I find any way to do this I will post. I am posting it here because your expertise and community can be helpful to me.

taicyber commented 6 years ago

I also wants this function. I hope that you will consider to develop this function into the plugin.

taicyber commented 6 years ago

Hi tomolimo, thanks for your considering to add this function into 3.4.0 milestone. Looking forward to use it.

tomolimo commented 5 years ago

Due to big current workload it will not be for 3.4.0, but for 3.4.x, sorry for that

tomolimo commented 5 years ago

Hello @rohit-ambre-uno This issue is in progress, and I'd like to have a kind of brainstorming with you about this.

To start: We need to define the way to get back a response from end-user. I propose to use a mechanism like the SMS:

Answer to this SMS with YES if you agree, and NO if you don't agree

So in the use-case of an email it will be something like:

If you approve this request then reply with YES, and if you disagree then reply with NO to this email.

A unique token (like: a2fe782065db6eefaee0d3d37c622e53) that encapsulates mandatory information to manage the answer (case_id, task_id, del_index, and ...) will be present in the email subject to ensure that it will be present in the reply.

So the email subject will look like something below:

[GLPI #0238348] New task - Manager approval [PM a2fe782065db6eefaee0d3d37c622e53]

For me this solution is the only one that is possible to do.

Thank you to give your feedback

Regards, Tomolimo

tomolimo commented 5 years ago

Of course this will be feasible when bundled with #77 which will permit dedicated notification template to tasks.

rohit-ambre commented 5 years ago

Hi, I am the same User who posted this issue but with other github account, I merged my 2 of my accounts.

Thank you for replying @tomolimo As I mentioned in my previous comment that my users wanted to Approve or Reject tasks on mails and this was very crucial for me around the time of feb to integrate this with GLPI and Processmaker. So I started digging to find a way out of this and I did, I don't know how Good is this way is but it did solve my use case Sorry I forgot I have posted about this issue and I didn't share it before

I tried to make very few changes in Processmaker plugin and mainly used GLPI

Below I will explain How I solved it.

  1. Processmaker plugin changes
  1. Processmaker Server

So now I have emailIDs of users in processmaker-server also.

In Workflow designer if my 3rd task is to be done Over email then I created 2 triggers and set one to run before dynaform and other to run after Dynaform of 2nd task.

As you can see in screenshot above, I created approve string and reject string which has APP_UID, variable to set, value of that variable and variable to check if process has routed and separated them with '=' sign and encoded it in base64.

Screenshot from 2019-07-29 19-36-49

Now once the second task is completed processmaker server will send an email using the template mentioned in mail send function

\Click to Approve\</a>
\
Click to Reject\\

I have also added "" in the start and "" in the end of approval and rejection string, I will explain the use below

  1. GLPI

Now the assigned user for 3rd task will receive a mail and as he will click on any of the link it will draft new mail and he only has to click on send mail button.

This email will go to emailID which is getting used in GLPI for mail receiving whcih was set in 1st trigger.

Now I made few changes in mailcollector.class.php file to Approve and Reject the task

First I used a regex to filter out Approval mails from other GLPI incoming mails that's where I used above _*String*_

Now I have APP_UID , variable, value of variable so here I used first check whether Process_routed is set to fasle or not if Yes I used sendVariable SOAP api to set variable values and If i get success then I triggered route case SOAP API to route a task.

This is my solution to this problem Please feel free to suggest your thoughts on it

Thank You

tomolimo commented 5 years ago

Hello @rohit-ambre Thank you for your answer. The process you've developed is more or less what I proposed to do in the use case here: https://github.com/tomolimo/processmaker/issues/82#issuecomment-515382883 The differences are:

  1. use of GLPI notifications instead of PM notifications. Pros: possibility to localize very quickly templates. Same email sender than other emails. eMails are localized depending on user settings (and also based on the general notification settings). Since latest release 3.4.12, you may send these emails from GLPI (you may migrate the PM template into a GLPI notification template, via HTML source code copy/paste and changing the variable names).
  2. The answer: I used this technique in a previous version of GLPI. Cons: this kind of answer with reply in the HTML body will work only for email clients that accept HTML emails. I prefer when the end-users are forced to type-in some text to be sure that they are thinking about what they are doing (approval or rejection), and not only doing click-clicks. And also there are always users who click on 'Reply' and do not click on the links...
  3. Adding a hook in the PM plugin to provide the necessary code to manage the answer, instead of in GLPI core itself. Pros: in this way at next GLPI upgrade, there is no problem.
  4. In your answer is missing the delegation index, which represents the current running tasks of the case. You may have several running tasks at the same time in a case (=parallel tasks). And I believe that the flag Process_routed would not have been mandatory if you had used the delegation index (PM doesn't permit the derivation of a delegation index that has already been routed).
  5. You did not mention the way you used to do the evolution of the case in GLPI: I mean how the ticket tasks are managed?

Thank very much for the description of your process, it will helped me to define the one for the plugin (and of course I'll try as much as possible to provide something that will give you possibility to migrate to with less effort).

First step for you, would be to migrate the notification template to GLPI using the new Notification feature included into the 3.4.12 release. Let me know if you need more information about it.

Thank you Regards, Tomolimo

rohit-ambre commented 5 years ago

Hi,

Thank you for considering my solution.

Replies to your points:

  1. Yeah localisation will become very easy if we use GLPI notifications, in my case i have to only consider english.
  2. Here My users are going to use mails only so I gave very small description in mail body click on any of the link below and just click send, Users can still type what they want to unless they change approval or rejection at the bottom of the mail which will get displayed in Ticket followups.
  3. Yeah adding a hook is very nice Idea and I should give it a try.
  4. I forgot to mention that I also used CaseInfo SOAP api to get delIndex of current task before routing a task. and I added process routed variable because in testing I found out if next task is also assigned to the same user then If I send approval mail multiple times before then it will route that 4th task also without filling any fields so I set value true after successful routing of a task using SendVariable SOAP api.
  5. Yes, I was going to explain it today but you replied so here it goes I found this issue that my next task is not getting generated as Everything is happening over SOAP apis so what I did is, Processmaker plugin uses Derivate function to handle the task management in GLPI which is written to handle normal task routing so created a copy of derivate case function which does same functionality as the derivate case but it gets called after I get Success from RouteCase API. I made few changes in this function to adapt changes for arguments coming in different format like I removed routecase function call, changed the variable which is used to create further tasks, etc

Hope my explanation helps you If you have anything to discuss please suggest

Thank You

kintaro1981 commented 2 years ago

is this been added to GLPI 10?

tomolimo commented 2 years ago

Hello @kintaro1981 Currently this feature has not been added to the plugin. And currently the plugin is not yet compatible with GLPI 10.0 You'll have to wait a little bit (till automn this year) Thank you, Regards, Tomolimo