Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Approval of processmaker task over email in GLPI #82

Open
rohit-ambre-uno opened this issue Aug 22, 2018 · 10 comments
Open

Approval of processmaker task over email in GLPI #82

rohit-ambre-uno opened this issue Aug 22, 2018 · 10 comments
Assignees
Labels
enhancement wip Work In Progress
Milestone

Comments

@rohit-ambre-uno
Copy link
Contributor

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
Copy link

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

@tomolimo tomolimo added this to the 3.4.0 milestone Oct 26, 2018
@taicyber
Copy link

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

@tomolimo
Copy link
Owner

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

@tomolimo tomolimo self-assigned this Jul 26, 2019
@tomolimo tomolimo added the wip Work In Progress label Jul 26, 2019
@tomolimo
Copy link
Owner

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
Copy link
Owner

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

@rohit-ambre
Copy link

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
  • I synced emailID along with other information from pmuser automatic action
  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.

  • Trigger 1 (before dynaform)
    Now here I already know what variables is to be set for my task to move forward so Created few variables which can be used in Processmaker templates.
    Screenshot from 2019-07-29 19-30-39

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.

  • Trigger 2 (after dynaform)
    Now in this trigger I will send a mail to user who is going to approve the task from Processmaker server using mail configuration provided by the processmaker-server

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

  • Template configuration
    In template I added following lines which will use the variables from 1st trigger and mailto link to open up a mailbox in which everything will be already set based on the link he clicks on

<a href="mailto:@=mailRec?subject=@=mailsubject&body=Approved%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0APlease%20Do%20not%20clear%20following%20line%0D%0A_%2A@=approval%2A_" target="blank">Click to Approve</a>

<a href="mailto:@=mailRec?subject=@=mailsubject&body=Rejected%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0APlease%20Do%20not%20clear%20following%20line%0D%0A
%2A@=rejection%2A_" target="_blank">Click to Reject</a></p>

I have also added "" in the start and "" in the end of approval and rejection string, I will explain the use below
3. 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
Copy link
Owner

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: #82 (comment)
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
Copy link

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

@tomolimo tomolimo modified the milestones: 3.4.0, 5.0.0 Dec 16, 2021
@kintaro1981
Copy link

is this been added to GLPI 10?

@tomolimo
Copy link
Owner

tomolimo commented May 6, 2022

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

@tomolimo tomolimo modified the milestones: 5.0.0, 5.1.0 Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement wip Work In Progress
Projects
None yet
Development

No branches or pull requests

5 participants