Saturday, November 21, 2015

How to do deployment through Changesets in Salesforce

Step1:
Login into the Sandox and then follow the below

Setup > Depoly > Outbound changeset > create new changeset > add components(Let say classes,pages etc.,) > Upload

Then logout from sandbox.

Step2:

Login into the Production

Setup > Depoly > Inbound changeset > Validate > Deploy

Note:
1.From Sandbox Just create outbound changeset and in the Production receive the Inbound changeset.
2.If any of them failed due to any reason the total will be rolled back.

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
return String.valueOf( new PageReference('/'+Case.Id).getUrl());
and in your Button, you have to catch your return String and reload the page:
var newurl = sforce.apex.execute("TestClass","CreateTestRecords", {id:"{!Case.Id}"});
parent.location.href = newurl; //refresh the page