Unable to Set "Work Notes" mandatory for sc_task table

CharanV66187530
Kilo Guru

Hi @everyone,

Can any one help me on how to make mandatory "work notes" in sc_task table by using UI action. I tried i am able to set "Notes" section instead "work Notes".

function onclieck(){

g_form.setmandatory('work_notes');

}

1 ACCEPTED SOLUTION

CharanV66187530
Kilo Guru

We have to use both Client Script and Script Include to make mandatory. 

View solution in original post

9 REPLIES 9

@CharanV66187530 

As already said your syntax is wrong

55.png

💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏

In Ui Policy  ->Script tab->Execute if true, 

write it and check: 

 

function onCondition() {
           g_form.setMandatory('work_notes',true);
       }
 

Hello @CharanV66187530 
1. The spelling of click is incorrect.

VishalJaswal_0-1778165391701.png

2. When you use setMandatory('field_name', 'you specify here as true or false');

VaniMadhuri
Tera Expert

Hi @CharanV66187530 

 

Work Notes is not a normal field, it belongs to journal fields.

g_form.setMandatory() does not work reliably on journal fields like work_notes and comments. That’s why it’s not enforcing.

Use g_form.getValue() and block submission. Try below code it may work for you

function onClick() {

    var notes = g_form.getValue('work_notes');

    if (!notes) {
        g_form.addErrorMessage('Work Notes is mandatory');
        return false; // stop action
    }

    // allow action
    return true;
}

 

CharanV66187530
Kilo Guru

We have to use both Client Script and Script Include to make mandatory.