The CreatorCon Call for Content is officially open! Get started here.

Redirect user to a different url using Business rule

Alon Grod
Tera Expert

Hi,

Im trying to redirect user using onAfter Business rule but I had no luck, what am I doing wrong?

var gr = new GlideRecord('sys_attachment');
	gr.addEncodedQuery('table_sys_id='+current.getUniqueValue());
	gr.query();
	if(gr.next()){
		gs.log('zhahgaha');
		gs.setRedirect('/sys_attachment.do?sys_id=2522a51393c30210b73aba7efaba105a');
	}
8 REPLIES 8

Jaspal Singh
Mega Patron
Mega Patron

Hi Alon,

Can you try replacing

gs.setRedirect() with action.setRedirectURL('/sys_attachment.do?sys_id=2522a51393c30210b73aba7efaba105a')

@Jaspal Singh i tried its not working

SanjivMeher
Kilo Patron
Kilo Patron

I think you may need to full URL. Can you try below

var url = gs.generateURL('sys_attachment', gr.sys_id);

gs.setRedirect(url);


Please mark this response as correct or helpful if it assisted you with your question.

@SanjivMeher still not working