Populate the error message by using the UI action

DeepikaR1661877
Tera Contributor

Hi Every one,

when i click the cancel UI action an Active SIR record without providing work notes

in that Cancel UI action i have created the scripts to populated the error message, the error message is shown but it's gone when the page is fully completely loaded, I want a warning message banner should appear on top of form and stay there after page is completely loaded, below is the UI script, any suggestion please.

 

if (current.work_notes == "") {
gs.addErrorMessage("Worknotes mandatory. Please write cancellation reason in the worknotes.");
//action.setRedirectURL(current);
}else {
var wf = new global.Workflow();
wf.cancel(current);
current.state = 7;
current.update();
}

1 ACCEPTED SOLUTION

Sherin Jenifer
Giga Guru

Hi @DeepikaR1661877 ,

Please try the below code:

UI Action cancel.png

function errorOnEmptyWorkNote() {
    if (g_form.getValue('work_notes') == "") {
        g_form.addErrorMessage("Worknotes mandatory. Please write cancellation reason in the worknotes.");
        return false;
    }
    gsftSubmit(null, g_form.getFormElement(), 'cancel_action');
}

if (typeof window == 'undefined')
    Cancel();

function Cancel() {
    var wf = new global.Workflow();
    wf.cancel(current);
    current.state = 7;
    current.update();
}

 

 


If you find this helpful, please mark as Correct or Helpful.

View solution in original post

7 REPLIES 7

Hi @Sherin Jenifer ,

Yeah, it's working, thank you!

Susmitha A
Tera Contributor
var work_notes = g_form.getValue('work_notes').toString().trim();   
if(work_notes == ''){
        g_tabs2Sections.setActive(<provide the index number of the tab>); // Move to  relevant tab eg: if worknotes is one the scond place provide number as 1
        g_form.addErrorMessage('Worknotes mandatory. Please write cancellation reason in the worknotes.');
}

Susmitha A
Tera Contributor
var work_notes = g_form.getValue('work_notes').toString().trim();
   
    if(work_notes == ''){
        g_tabs2Sections.setActive(<provide the index number of the tab>); // Move to the relevant tab Eg: if worknote is on the second place then the index should be 1.
        g_form.addErrorMessage('Worknotes mandatory. Please write cancellation reason in the worknotes.');
}

If you find this helpful, please mark as Correct or Helpful.