- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2021 08:37 PM
Hi Community,
I am trying to implement an approval via email but the OOB inbound action does not seem to be working. In the logs I can see this message - Update Approval Request : did not create or update sysapproval_approver using current, then after sending the approval via email, it is being received and I can see it from the approval logs but the script in the OOB inbound action does not do anything. The approval state remains requested but based on the script in the OOB Update Approval Request inbound action once 'approve' it should change the state to approved or reject when rejected.
Anyone had encountered the same issue? Need your advise. Thank you.
Regards,
Ramel
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2021 10:01 PM
#Inbound actions to record action (written on change_task, record_action , reply)
condtion : email.subject.indexOf("autoclose") >= 0 // checks email subject for autoclose keyword
Action script:
if (current.getTableName() == "change_task") {
if (validUser()) {
current.work_notes = "reply from: " + email.from + "\n\n" + email.body_text;
// if it's been cancelled, or completed already it won't update
var doit = true;
if (current.state == '3' || current.state == '4' || current.state == '5' || current.state == '6' || current.state == '7')
doit = false;
if (email.subject.indexOf("Closed Complete") >= 0) // checks email subject for closed complete keyword
{
current.close_notes = email.body_text;
current.state = '3';
}
if (email.subject.indexOf("Closed Incomplete") >= 0) // checks email subject for closed Incomplete keyword
{
current.close_notes = email.body_text;
current.state = '4';
}
if (email.subject.indexOf("Closed Cancelled") >= 0) // checks email subject for closed cancelled keyword
{
current.close_notes = email.body_text;
current.state = '5';
}
if (email.subject.indexOf("Closed Complete with Issues") >= 0) // checks email subject for closed complete with issues keyword
{
current.close_notes = email.body_text;
current.state = '6';
}
if (email.subject.indexOf("Closed and Failed") >= 0) // checks email subject for Closed and Failed keyword
{
current.close_notes = email.body_text;
current.state = '7';
}
if (doit) {
current.update();
} else {
gs.log("Update for Change Task ("+current.number + ") failed. Details: Invalid state. Task can only be updated if state is not already completed or cancelled");
}
} else {
gs.log("Update for Change Task ("+current.number + ") failed. Details: invalid user. Task can only be updated by the assignee, not " +email.from );
}
}
function validUser() {
var user = email.from_sys_id;
var ourUser = gs.getUser();
ourUser = ourUser.getUserByID(user);
ourUser.isMemberOf(current.assignment_group);
if(ourUser)
{
return true;
}
else if (current.assigned_to == email.from_sys_id)
{
return true;
}
}
Now go to templates under system notification and create records as below
Go to notification and link template
{$mailto:<template_name>} is the format to link template to notification
Change above data as per your convenience. Presently it is in change_task table. and do action based on email subject from user who is the member of the assignment group of change task.
Thank you,
Arkesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2021 02:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2021 07:52 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2021 06:12 AM
Hello Ramel,
Exactly I am facing the same issue. I am unable to resolve it.
The approval state is still in requested only even if the user approves it from different domain email.
And for us there are no 2 user records of with same email.
Could you please clearly explain what exactly you did.
It helps me a lot.
Please assist.
Thank you,
Priya.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2024 01:07 PM
Thank you for this comment! I had a similar situation and I am banging my head against the call not able to figure it out. Saw your comment, went to check, and sure enough, two records on the table for the same e-mail and user name!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2021 10:01 PM
#Inbound actions to record action (written on change_task, record_action , reply)
condtion : email.subject.indexOf("autoclose") >= 0 // checks email subject for autoclose keyword
Action script:
if (current.getTableName() == "change_task") {
if (validUser()) {
current.work_notes = "reply from: " + email.from + "\n\n" + email.body_text;
// if it's been cancelled, or completed already it won't update
var doit = true;
if (current.state == '3' || current.state == '4' || current.state == '5' || current.state == '6' || current.state == '7')
doit = false;
if (email.subject.indexOf("Closed Complete") >= 0) // checks email subject for closed complete keyword
{
current.close_notes = email.body_text;
current.state = '3';
}
if (email.subject.indexOf("Closed Incomplete") >= 0) // checks email subject for closed Incomplete keyword
{
current.close_notes = email.body_text;
current.state = '4';
}
if (email.subject.indexOf("Closed Cancelled") >= 0) // checks email subject for closed cancelled keyword
{
current.close_notes = email.body_text;
current.state = '5';
}
if (email.subject.indexOf("Closed Complete with Issues") >= 0) // checks email subject for closed complete with issues keyword
{
current.close_notes = email.body_text;
current.state = '6';
}
if (email.subject.indexOf("Closed and Failed") >= 0) // checks email subject for Closed and Failed keyword
{
current.close_notes = email.body_text;
current.state = '7';
}
if (doit) {
current.update();
} else {
gs.log("Update for Change Task ("+current.number + ") failed. Details: Invalid state. Task can only be updated if state is not already completed or cancelled");
}
} else {
gs.log("Update for Change Task ("+current.number + ") failed. Details: invalid user. Task can only be updated by the assignee, not " +email.from );
}
}
function validUser() {
var user = email.from_sys_id;
var ourUser = gs.getUser();
ourUser = ourUser.getUserByID(user);
ourUser.isMemberOf(current.assignment_group);
if(ourUser)
{
return true;
}
else if (current.assigned_to == email.from_sys_id)
{
return true;
}
}
Now go to templates under system notification and create records as below
Go to notification and link template
{$mailto:<template_name>} is the format to link template to notification
Change above data as per your convenience. Presently it is in change_task table. and do action based on email subject from user who is the member of the assignment group of change task.
Thank you,
Arkesh