We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Issue with redirection on case

mania
Tera Contributor

Hi,

 

I have created one business rule so when i am testing that on case form sometimes that is redirecting to another page so how to stop redirection 

Before/Inser, update

(function executeRule(current, previous /*null when async*/ ) {
    var workNoteType = current.u_work_note_type + ''; // Ensure string
    var emailNotification = current.u_email_noti_type + '';
          if (workNoteType == 'Customer Communication' && emailNotification == 'internal') {

            var msg1 = gs.getProperty('case.worknote.customer.internal.error');
            gs.addErrorMessage(msg1);
            current.setAbortAction(true);
            return;
        }
})(current, previous);

 

mania_0-1769771422428.png

Thanks!

6 REPLIES 6

vaishali231
Kilo Sage

hey @mania 

 

add client script also 

function onSubmit() {
    var workNoteType = g_form.getValue('u_work_note_type');
    var emailNotification = g_form.getValue('u_email_noti_type');

    if (workNoteType === 'Customer Communication' && emailNotification === 'internal') {
        g_form.addErrorMessage(
            'Internal email notification is not allowed for Customer Communication.'
        );
        return false; // Stops save — NO redirect
    }
    return true;
}


*************************************************************************************************************
If this response helps, please mark it as Accept as Solution and Helpful.
Doing so helps others in the community and encourages me to keep contributing.

Regards
Vaishali Singh

@vaishali231 

Thanks for responding

I want that in before business rule

Thanks!

hey @mania 

 

try this business rule 

(function executeRule(current, previous) {

    if (!gs.isInteractive()) {
        return;
    }

    var workNoteType = current.u_work_note_type + '';
    var emailNotification = current.u_email_noti_type + '';

    if (workNoteType == 'Customer Communication' && emailNotification == 'internal') {
        gs.addErrorMessage(gs.getProperty('case.worknote.customer.internal.error'));
        current.setAbortAction(true);
    }

})(current, previous);


*************************************************************************************************************
If this response helps, please mark it as Accept as Solution and Helpful.
Doing so helps others in the community and encourages me to keep contributing.

Regards
Vaishali Singh

hey @mania 

 

Hope you are doing well.

Did my previous reply answer your question?

If it was helpful, please mark it as correct ✓ and close the thread 🔒. This will help other readers find the solution more easily.

Regards,
Vaishali Singh