AnsweredAssumed Answered

Using SPL code to evaluate Change field form

Question asked by carlosgrv on Nov 12, 2018
Latest reply on Nov 13, 2018 by carlosgrv

I have this request in the change form:

I have the category field and the root cause fields.

Some categories of development area need a root cause and others areas doesn´t need it.

I want that when the user clics the save button in order to create a change order, the function evaluates than if the category field is fill with a development category and the root cause is blank, display a message warning that if "you choose this category it must be set with a root cause, in others cases it will be ok (for example if  the category is another accepts or not a root cause)"

 

This is my function I want to achive with spl code:

 

file.mod

MODIFY chg {PRE_VALIDATE zValidateRootCause() 4200 FILTER(EVENT("INSERT"));};

 

file.spl

chg::zValidateRootCause(...) {
string zmsgA21;
{
if (category == '401314' && rootcause == '' ) {
zmsgA21=format("For this category must be a select a root cause",chg_ref_num,requestor);
set_error(1);
set_return_data(zmsgA21);
return;
}
}
}

 

But when I create a change order of development area, the function doesn't evaluate the values I put on the respective fields. Root cause (Causa raíz) field is in blank and Category (Categoría) field is set with the name of development category "GD.Desarrollo". The number 401314 used on the validate function is the id of the category in the chgcat table from the mdb db.

 

 

 

What am I doing wrong?

I dont' know if I can do this directly in the regular form Detail_chg.htmpl

 

Thanks for the help you cand provide.

 

Regards

Carlos Ramirez

 

sdm fields

sdm

servicedesk 14.1

spel

spel code

change order workflow

Outcomes