Wednesday, April 15, 2015

Enable inline editing after overriding Edit button of Salesforce Object

When we override edit button of any object in sales force then inline editing of that object in other standard layouts are disabled for that specific object.

We can provide inline editing in visualforce page for which we have overridden the edit button using <apex:inlineEditSupport> tag, but if object uses different record types and based on record types different standard page layouts are assigned then inline editing is disabled in all that layouts.

To Enable inline editing in all other standard layouts, we have to do the following steps

Do not override the object with any visualforce page, instead do the page redirect from home page component.

Create a home page component with following javascript code, and add that home page component to the current home page layout.


<script>
    var objectCode = window.top.location.pathname.substring(1,4);
    var isedit = window.top.location.pathname.substring(16,18);
    var noOverride = window.top.location.search.search('nooverride=1');

if(objectCode == 'objCode' && (isedit == '/e') && noOverride == -1){
    var pid = window.top.location.pathname.substring(1,16);
    window.top.location = '/apex/VisualforcePage?id='+pid;
}
</script>

in that visualforce page perform proper redirection in action method of page, and redirect page to standard layout by adding nooverride=1 in the url

ex:
http://salesforceInstance/Recordid?nooverride=1


Hope this helps!!

Thanks

Implementing Escalations Rules on Custom Objects in Salesforce

Salesforce provides Escalation actions only in Cases Object.We can implement escalations actions on custom object by creating 2 time dependent workflow rules for respective object

Steps as follows

Create one Date custom field -- Next Escalation Date in salesforce.

1st Time Dependent Rule:

  1. Define conditions for workflow rule
  2. Add Time Dependent workflow Trigger based on days of escalations
  3. Create following Time dependent workflow actions
    • Send an Escalation email
    • Create Field update to set Next Escalation Date field to Today


2nd Time Dependent Rule:

  1. Use same conditions defined in 1st rule and add extra condition for Date Field to check for today
  2. Add Time Dependent workflow Trigger based on days of escalations 
  3. Create following Time dependent workflow actions
    • Send an Escalation email
    • Create Field update to set Next Escalation Date field to Today

2nd Workflow rule will trigger recursively, till the time condition is satisfied.