0

My question came from this Display field ONLY in edit mode using Page Layout

To Achieve this functionality.

  1. First goto any Account detail page. Select name field and press F+12 to open console. Now there you can see the Name field inside td. So I copied the id.

  2. Now created a javascript custom button and added this script document.getElementById("00N9000000AlpZK_ilecell").ondblclick();

I intention is when standard page load then fire this javascript so dblclick fire the inline edit.

We can't use the VF page. Reason salesforce doesn't allow us to perform cross site scripting.

Not sure this is possible or not. Need Experts feedback.

Thanks in Advance

1

On the whole, SF have tried to close down hacky routes to doing this kind of thing (see End of javascript sidebar workarounds?). Which is annoying when they don't provide a legitimate way to customise some things, but understandable since hacks using that technique will tend to rely on things that SF do no promise to keep consistent across versions (e.g. the id of certain components in the DOM)

So, if you really need to monkey around with the view page for an object, the most legitimate way to do it is to make a VF page and use <apex:detail> to pull in the standard view of the object. This will show the normal view, as defined by page layouts, profiles, and record types. Underneath the <apex:detail>, you will then be able to run any javascript you need and it will all be coming from the same domain so you can interact with the DOM. Then, set this VF page to override the view for your object. The page would look something like this:

<apex:page standardController="Account">

<apex:detail title="true" relatedList="true" showChatter="true" relatedListHover="true" subject="{!Account.id}" inlineEdit="true" id="accountDetail" />

<script>
    // Mess around with the DOM here
</script>

</apex:page>
  • Yes I know i can do it with apex:detail but looking for a solution with scripting. – Ratan Paul Nov 25 '15 at 8:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.