Tuesday, June 27, 2017

How to Return PageReference from a webservice method

In your Class use a String as a Returntype
and create your reference like this in your webservice class
?
1
return String.valueOf( new PageReference('/'+Case.Id).getUrl());
and in your Button, you have to catch your return String and reload the page:
?
1
2
var newurl = sforce.apex.execute("TestClass","CreateTestRecords", {id:"{!Case.Id}"});
parent.location.href = newurl; //refresh the page

No comments:

Post a Comment