Sunday 15 October 2017

Simple Way to Override An object new button in Salesforce!

Hi Folks,

How are you doing? Obviously fine :P.

I have been getting active back socially of course for Salesforce. I saw a problem statement on overrding a new button on standard salesforce object.
I am not sharing something new, it is just sharing some cool out of box functionalities of salesforce for overrding the a new button .

NO intensive code. 


Are you aware of action attribute of visualforce, URLFOR and $Action then I believe you will save your lot of time in visualforce coding.

Lets say you want a return Url to be lead view page. Now, instead of coding and having apex class you can actually make it easy by just adding this in action attribute.


<apex:page standardController="Lead" 
  action="{!URLFOR($Action.Lead.New,$ObjectType.Lead,[lea3=$User.companyname,retURL=$ObjectType.Lead.keyprefix],true)}">
</apex:page>


Yes, its very easy to override and also to make your return URL of your choice. In case you stuck in any error, need not say just message me. We will Demitsify it together and spread learning.


Happy Coding :)

Thanks
Ankush


oAuth Use Case -  Headless API Explained in the Easiest way Wondering why? and When we use the Headless API flow Use case example: Imagine a...