Need to show an error message only on the classic UI but should not appear on the Service portal sid

prasannasan
Tera Contributor

Hi,

 

I have a requirement to display the error message if the assignment group is empty only on the classic UI but to hide it on the Service Portal.

 

Will the below logic work?

 

if (gs.isInteractive() && gs.getSession().getStackName() !== 'Service Portal') {
gs.addErrorMessage('There is no assignment group');
current.setAbortAction(true);
}

10 REPLIES 10

Shivalika
Mega Sage

Hello @prasannasan 

 

Is it for a catalog form ? Classic UI you mean you are opening the catalog form in native UI ? 

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY

Its an incident record, and yes, I meant native UI when I mentioned Classic UI

 

It is an incident record. Yes, I meant native UI.

Hello @prasannasan 

 

Okeh, so you want to restrict any activity if the assignment group is empty and when are you doing that - insertion, during update ? 

 

Client script won't stop any activity, it will just give error message, it will stop only when you are using on submit client script  while insertion. 

 

Business rule will only work if you want to abort any further activities. But are you saying that when you are writing general business rule its also working on the portal ? That shouldn't be the case. 

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY