AnsweredAssumed Answered

fetching properties of Change order before save

Question asked by Mr.Venkat on Nov 9, 2015
Latest reply on Nov 24, 2015 by Mr.Venkat

Hi,

 

I would like to fetch  Change request values and labels of properties  to validate before save of Change Request.

 

Example if a change request category have two properties.

 

While creating a change order  I have to make a property mandatory(required) depends on the value provided on other Property.

 

I have found two possible  options . First one is using pdm_list fetch the property list  and validate property values on save of a change request.

 

but this option is bit tricky that inside java script function  pdm_list  is not working.

 

second option is using spel customization below is the code that i am trying with below Code to fetch property value and Label


@


chg::zcheckprp(...)
{
string method,wc;
method = "zcheckprp";
int chgid;
chgid = argv[3];
wc= format("object_id = %d",chgid);
logf(TRACE,"argv[3]=%d",chgid);
logf(TRACE,"wc=%s",wc);
uuid who;
send_wait(0,top_object(), "call_attr", "cnt", "current_user_id");
who=msg[0];
send_wait(0, top_object(), "call_attr", "api", "get_list","prp",who,wc, -1);
if (msg_error()) {
logf(ERROR, "get_group_leader () failed: %s", msg[0]);
}
else
{
int count;
  object obList;
  count = msg[1];
  obList = msg[0];
logf(ERROR,"count=%d",count); //Here the count is getting as 0 (zero)
  send_wait(0, top_object(), "call_attr", "api", "get_list_values", who, obList,0,count,0,"lable","value");
if (msg_error()) {
logf(ERROR, "get_group_leader () failed: %s", msg[0]);
  }
  else
  {
  int i;
  printf(argc);
  for (i=0;i<msg_length();i++) {
  logf(TRACE, "msg[%d]: '%s'", i, msg[i]);
    }
  }
}
}




in the line 24 of above code the trace logging 'count' variable value as 0.

 

 

any suggestions.

 

Message was edited by: VENKAT V

Outcomes