Jump to content

Workflow task status not getting updated on the Change Order

Recommended Posts


I've created an action macro to set the status of the change order to "Reject", and notify the CO requestor when the change has been rejected.

The code I've used is:

// send_wait(0, top_object(), "call_attr", "api", "chg", (uuid)'00',chg.persistent_id, 0,"status", "chgstat:400007"); 

string evt_mtitle, evt_mbody;
evt_mtitle = format("Your Request # %s has been rejected", chg.chg_ref_num);
evt_mbody += format("Request Date: %s\n", chg.open_date);
evt_mbody += format("Request Category: %s\n", chg.category.sym);
evt_mbody += format("Request Description: %s\n", chg.description);
evt_mbody += format("Rejected By: %s\n", assignee.combo_name);
evt_mbody += format("Rejecter's Comments if any: %s\n", description);
evt_mbody += format("Click on the following URL to view your Change Request: \n%s\n", chg.web_url);

int evt_level;
evt_level = 2;
int trans_pt;
trans_pt = 29; //use 29 for Change Order
string contact_persid;
contact_persid = format("cnt:%s", (string)chg.requestor);
send(top_object(), "call_attr", "cnt", "notify_list",
contact_persid, evt_level, evt_mtitle, evt_mbody, "", trans_pt, persistent_id, 0, 0);

if (msg_error()) {
logf(ERROR, format("Macro event error '%s'", msg[0]));

I've been banging my head since the status isn't getting changed at all. The notification macro isn't firing either. I'd appreciate it if anyone could please guide me as to where I'm going wrong.

Thanks in advance.


Share this post

Link to post
Share on other sites

How is your maco executed? What wil trigger the execution? First make sure that your macro is executed. Add a logf statement just at the top of your macro to check this.

Share this post

Link to post
Share on other sites

Thanks for the response Mikelm. I've associated the macro with the reject behavior of the approval workflow task. I've modified my code some, and the email notification is going through now. There's no change in the CO status though.

I've tried to set the status using, chg.status = "RJCT", but that didn't pan either. I'll see if I have any luck with the log statements, and let you know. Thanks again.

Share this post

Link to post
Share on other sites

Status is referenced by its code value. So figure out the code value of the status you want to set. Then try to set the status with

parent.status='your status code value'

Share this post

Link to post
Share on other sites

Try the code like this:

this.chg.status = "APR";

I´m using this code and its working well

Edited by ferrarini

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...