How to remove info messages

amaradiswamy
Kilo Sage

Hi All,

I have written an before update business rule to make the changes not saved if particular condition matches at the time of closure. It is working as expected. it is throwing some error message so that user can check the reason, but along with the error message i am getting "Problem resolved" message also which was mentioned in "Resolve problem" UI action .

Business rule logic:

  current.setAbortAction(true);

  current.state = previous.state;

  gs.flushMessages();

  gs.addErrorMessage('This ticket can not be closed until the related '+itcc.number+ ' is closed');

  action.setRedirectURL(current);

UI action script at the end:

if (typeof window == 'undefined')

    serverReopen();

function serverReopen() {

    // Set Incident state to active, update and reload the record

    current.state = 11;

    current.update();

    gs.addInfoMessage(gs.getMessage("Problem resolved"));

    action.setRedirectURL(current);

}

Please helpme to overcome this issue.

Thanks and regards,

Swamy

6 REPLIES 6

BALAJI40
Mega Sage

if (typeof window == 'undefined')


    serverReopen();


function serverReopen() {


    // Set Incident state to active, update and reload the record


    current.state = 11;


    current.update();


    gs.addInfoMessage(gs.getMessage("Problem resolved"));// remove this one


    action.setRedirectURL(current);


}


But, i want this to be displayed when they are resolving the problem successfully.



Regards,


Swamy


palmen
Tera Guru

If you have problem with the UI Action adding a message, you need to look at the UI Action logic, not the Business Rule.


The UI Action will trigger when you click on it and there can be booth server and client side code.


how can i change the logic for



if (typeof window == 'undefined')


  serverReopen();



to work as per my logic?



could you please help me on this?



Thanks and regards,


Swamy