You need to sign in to do that
Don't have an account?
Ravi_SFDC
Thanks & Regards
Ravi
Save Button Issue
Having an issue i my Save Code. Code is as below
public PageReference doSave() { try{ List<Unidentified_Deals__c> uds = new List<Unidentified_Deals__c>(); for(oppWrap o:opps){ if(o.check){ Unidentified_Deals__c u = new Unidentified_Deals__c(Name=o.opp.Name,Opportunity__c=o.opp.Id, Account_Plan__c=accountPlanId, Account__c = o.opp.AccountId); uds.add(u); } } insert uds; upsert od; upsert lw; fetchOpps(); ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.INFO, 'Saved and Refreshed!!'); ApexPages.addMessage(myMsg); }catch(Exception e){ ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.Error, e.getMessage()); ApexPages.addMessage(myMsg); } return null; }The content is getting saved, but only excuting the "Saved and Refreshed". I don't want to execute "Saved and Refreshed", i want the page to return to the previous page where i cam from. Your help is really appreciated.
Thanks & Regards
Ravi
All Answers
You need to modify your return statement to the code given below. comment out "return null" and replace with below code.
PS: if this answers your question then hit Like and mark it as solution!
My URL is as https://myinstancename/a1819000000lunB on which i do have custom button. When i click on the cuctom button i do have the save button for the which the code is above. So when i click on SAVE button it should return to the https://myinstancename/id. I have commented the return null and provided your code, but this didn't work.
Replace sObject with your object and add this code in your class And modify the pageReference with below code
Hope this helps!!