AnsweredAssumed Answered

AHD03025:Attempt to modify non_CO value

Question asked by fsantan on Mar 10, 2016
Latest reply on Mar 13, 2016 by Gutis

Hi a spell code was created by our old support team to change the status of change order  depending on the workflow task completed but I am receiving the error message AHD03025:Attempt to modify non_CO value and the change stay locked and no one can be edited.

 

Here is the MOD

 

MODIFY wf {

POST_VALIDATE z_wf_chgstatuschange() 20025 FILTER ( EVENT("UPDATE") );

};

 

Here is the spel

 

wf::z_wf_chgstatuschange(...){

int debug_mode;
debug_mode = 1; //mude para 0 para cancelar o debug mode

if ( debug_mode == 1 ) {
  logf(SIGNIFICANT, "z_wf_chgstatuschange.spl -- Starting Spell ");
}

string spl_new_chgstatus;

if ( task == "INITWKFW" && status == "COMP" ) {
  spl_new_chgstatus = "APP";
  if ( debug_mode == 1 ) {
   logf(SIGNIFICANT, "z_wf_chgstatuschange.spl -- Comp Status...");
  }
} else if ( task == "ULAAPP" && status == "APP" ) {
  spl_new_chgstatus = "ULA";
  if ( debug_mode == 1 ) {
   logf(SIGNIFICANT, "z_wf_chgstatuschange.spl -- ULA Status...");
  }
} else {
  if ( debug_mode == 1 ) {
   logf(SIGNIFICANT, "z_wf_chgstatuschange.spl -- No options for this status...");
  }
  return;
}

int spl_chg_id;
spl_chg_id = (int)chg;
string spl_chgrefnum;
 
int chg_num;
object chg_list, obj_chg, grp_leader;

send_wait( 0, top_object(), "call_attr", "chg", "sync_fetch", "STATIC", format("id=%d",spl_chg_id), -1, 0);
if ( msg_error() ) {
  logf(ERROR, "z_wf_chgstatuschange.spl -- Error to define the list chg: %s", msg[0]);
  return;
}
chg_list = msg[0];
chg_num = msg[1];

send_wait( 0, chg_list, "dob_by_index", "DEFAULT", 0, 0);
if (msg_error()) {
  logf(ERROR, "z_wf_chgstatuschange.spl -- Error Instanciating CHG: %s", msg[0]) ;
  return;
}
obj_chg = msg[0];
spl_chgrefnum = (string)obj_chg.chg_ref_num;

send_wait(0, top_object(), "get_co_group");
if (msg_error()) {
  logf(ERROR, "z_wf_chgstatuschange.spl -- Eroor generating grp_leader: %s", msg[0]);
  return;
}
grp_leader = msg[0];
 
send_wait(0, grp_leader, "checkout", obj_chg);
  
send_wait(0, obj_chg, "call_attr", "status", "set_val", spl_new_chgstatus, "SURE_SET" );
if (msg_error()) {
  logf(ERROR, "z_wf_chgstatuschange.spl -- Erro saving : %s", msg[0]); <<<<< This is where it error
  return;
}
if ( debug_mode == 1 ) {
  logf(SIGNIFICANT, "z_wf_chgstatuschange.spl -- Changing the status : %s.", spl_chgrefnum);
}
  
send_wait(0, grp_leader, 'checkin');
if (msg_error()) {
  logf(ERROR, "z_wf_chgstatuschange.spl -- Error saving status: %s", msg[0]);
  int i;
  string tmp;
  for(i=0;i<msg_length();i++) tmp += (string)msg[i]+" : ";
  logf(ERROR, "z_wf_chgstatuschange.spl -- Error saving task= %s", tmp);
  return;
}

}

Outcomes