You need to sign in to do that
Don't have an account?
Luke Higgins 23
How to redirect to URL from webservice method
After clicking a link to create a record, I'm trying to redirect to a landing page. Currently, it just takes the user to an XML file tree. Here is the code I currently have -
The getCalloutResponseContents() is not redirecting to the URL provided
@RestResource(urlMapping='/approve/*') global with sharing class exAppClass { jstcl__TG_Timesheet__c ts = new jstcl__TG_Timesheet__c(); // GET request @HttpGet global static jstcl__TG_Timesheet__c doGet() { RestRequest req = RestContext.request; RestResponse res = RestContext.response; String tsid = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1); jstcl__TG_Timesheet__c ts = [SELECT Id, jstcl__Week_Ending__c FROM jstcl__TG_Timesheet__c WHERE Id = :tsid]; getCalloutResponseContents(); insertLog(ts); return ts; } private static Express_Approval_Log__c insertLog(jstcl__TG_Timesheet__c ts){ Express_Approval_Log__c log = new Express_Approval_Log__c(); log.Name = 'EAL '+ts.jstcl__Week_Ending__c; log.Timesheet__c = ts.Id; log.Approval_Date_Time__c= DateTime.now(); log.Status__c = 'Approved'; insert log; return log; } public static PageReference getCalloutResponseContents() { PageReference pageRef = new PageReference('https://testURL.com'); return pageRef; } }
The getCalloutResponseContents() is not redirecting to the URL provided
I hope you find the above information is helpful. If it does, please mark as Best Answer to help others too.
Thanks.