You need to sign in to do that
Don't have an account?
ranveer singh 8
Return pagereference from a webservice method.
Hi guys i have an webservice method i want thr return type to be page reference as i mentioned in code but i am not able to save it i am getting error as Error: Invalid return type: System.PageReference at line 2 column 37 .how do i need to achieve this guys any help would be appriciated
global class MyWebService {
webService static pagereference makeContact(String lastName) {
Contact c = new Contact(lastName = lastName);
insert c;
pagereference pga = new pagereference('https://ap1.salesforce.com/?id='+c.id);
return pga;
}
}
global class MyWebService {
webService static pagereference makeContact(String lastName) {
Contact c = new Contact(lastName = lastName);
insert c;
pagereference pga = new pagereference('https://ap1.salesforce.com/?id='+c.id);
return pga;
}
}
Please try the code below. Also, refer below link.
http://salesforcepunk.blogspot.sg/2015/11/How-to-Return-PageReference-from-a-webservice-method.html
Hope this helps you!
Thanks and Regards
Sandhya