7

For Visualforce pages the Standard New-Button created by <apex:detail> doesn't work correctly inside Visualforce containers on Flexipages.

Scenario:

enter image description here

I've put a Standard Visualforce Component on my Flexipage, pointing to a Visualforce page consisting of the following markup:

<apex:page standardController="elfBCProject__c" tabStyle="elfBCProject__c" recordSetVar="allItems"  >
    <apex:detail inlineEdit="false" relatedListHover="false" relatedList="true" showChatter="false" title="true" ></apex:detail>
</apex:page>

In my case it's for a Custom Object called elfBCProject__c - but you can use any Object for which a Flexipage is used.

Now inside that embedded VF Page most things work fine, but the Standard "New" Button for related lists has a crucial flaw: press it, and sforce.one beams you to the LEX-Version of the Record Create UI. So far, so good, but the Lookup towards the parent object is no longer populated as it MUST be, but it's just EMPTY:

enter image description here

Expected behavior would be like in Aloha:

enter image description here

Inspection of the button shows:

enter image description here

The reason behind all this is clear: LEX doesn't support the URL-hacking like this https://YOUR_DOMAIN.salesforce.com/a05/e?CF00N0Y000005N2De=10009+%E2%97%8F+Test+AG+Uwe+1+%E2%96%B6+2016+%E2%96%B6+2016&CF00N0Y000005N2De_lkid=a000Y000009Eggj&retURL=%2Fapex%2FtryPage_projectStdCtrl_tempUwe%3FsfdcIFrameHost%3Dweb%26isdtp%3Dp1%26id%3Da000Y000009EggjQAC%26sfdcIFrameOrigin%3Dhttps%253A%252F%252Fxe301-dev-ed.lightning.force.com&isdtp=p1

As an unfortunate, Salesforce uses these parameters in their Aloha code and the Link-wrapper injected for LEX-embeding plus the LEX UI for Creating Objects can't deal with that correctly now...

Does anyone know a quick and dirty workaround to fix this without the need of Flows or Actions? We have > 30 different Custom Object, and we only want to be able to create New objects in related lists. Creating Flows or Actions is a total Overkill for that. Using the Lightning Components for related list is unfortunately also not an option, because we are assembling many objects on one Flexipage (Standard Related List show only the one for the Flexipage-Record itself) and we need way more costomizability (e.g. Contacts as Card-Layout is just a show-stopper).

So how do we get the New-Buttons to life again... ?

Will Spring' 17 fix this? Summer'17? Or later? Or never?

2 Answers 2

0

This has apparently been reported as a known issue with no listed workaround at this time. https://success.salesforce.com/issues_view?id=a1p3A000001Yn4bQAC

0

If you're looking for a quick and dirty workaround, you could try the now-officially-supported URL hacking for lightning.

Replace the standard "New" button with a URL Button that uses Lightning URL prefill syntax. If you need this to work in Lightning and Classic simultaneously, you could detect the user's current context in the formula (using $User.UIThemeDisplayed) and render the URL for the appropriate context.

For example:

CASE($User.UIThemeDisplayed,
  'Theme4d', /* Lightning Experience */
  '/lightning/o/Child_Object__c/new?defaultFieldValues=Parent_Lookup__c={!Parent_Object__c.Id}',
  'Theme4u', /* Lightning Console */
  '/lightning/o/Child_Object__c/new?defaultFieldValues=Parent_Lookup__c={!Parent_Object__c.Id}',
  [classic URL hacking goes here as fallback])

Here is the documentation on Lightning URL parameter default value prefilling:

https://help.salesforce.com/articleView?id=sf.links_useful_custom_buttons_create_record_dfv.htm&type=5

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .