How do I redirect user to the order status page dynamically from record producer?

KedarB
Tera Contributor

KedarB_0-1713939414787.png

KedarB_1-1713939538598.png

KedarB_2-1713939688393.png

Hi guys, I am trying to redirect the user to the order status page of the request that gets generated when I am submitting a Ui builder form, but after submission it goes to the order status page with an empty request number.

I am using a catalog client script and a script include to do the same.

Could anyone guide me on the possibility of redirecting the users dynamically using the two?

Thanks.

 

 

 

2 ACCEPTED SOLUTIONS

hi @KedarB 
was the link usefull, if yes close the thread so that others will find it easy if they face the same thing.!!! 


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




Regards,
Animesh

View solution in original post

12 REPLIES 12

BrahmjeetTanwar
Tera Guru

Try using the below onSubmit client script to redirect to some url:
function onSubmit() {

var orderNumber = g_form.getValue('order_number');

var orderStatusURL = '/order_status_page.do?order_number=' + orderNumber; //whatever URL you want to make

 window.location.href = orderStatusURL;

 

}

 

Let me know if this works or if you have any questions.


Thanks,

Brahmjeet

Hi Brahmaraj, thanks for taking the time out,

the issue is that I am not able to fetch the latest request submitted by the current logged in user which is me in the script include and then calling the script include in the client script using scratchpad, but it doesnt seem to be working.

So I am looking for a solution on that, if you could please look into it and let me know.

Thanks,

Kedar.

could you please share the script include code because the image is not clear, i just want to see what is it that you are returning from script include and I don't think it will be all used.

Thanks,
Brahm

Sure, here it is.

KedarB_0-1713943789006.png

var redirecttorequestpage = Class.create();
redirecttorequestpage.prototype = Object.extendsObject(AbstractAjaxProcessor, {
	build_url : function(request){
		gs.info('kedar enter in script include');
		var req_sysid = request;
		//var req_url = gs.getProperty('glide.servlet.uri') + 'com.glideapp.servicecatalog_checkout_view_v2.do?v=1&sysparm_sys_id=' + req_sysid + '&sysparm_new_request=true&sysparm_view=ess&sysparm_catalog_view=catalog_default';
		g_scratchpad.ba_rec_prod = req_sysid;
		gs.info('kedar22' + g_scratchpad.ba_rec_prod);
		return req_sysid;
		//gs.setRedirect(req_url);
	},
    type: 'redirecttorequestpage'
});