• Vijay Vadgama
  • NEWBIE
  • 0 Points
  • Member since 2020

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
Hi everyone, 

I was wondering if someone can help me?

I'm actually having an issue when trying to "save" the record (pressing "Cancel" on the record is fine) after pressing the custom URL button. 

Here's a video example:
https://www.screencast.com/t/hrOkuHx4

Let me give you some background:

As we're transitioning to Lightning, the business is requiring Lead information to be populated to activities (which can't be done using Actions). I've created a URL hack for "New Task" which displays near the buttons on the Lead lightning page. Pressing the "New Task" button (and cancelling) is working fine, but when I try to "save" the Task record, it re-directs me to the Task page, despite having &retURL at the end of my hyperlink. 

I've tried every possible solution I can think of, but this issue still persists. Can somebody please help me if they know how to return to the record the button was pressed on? (in my case, Lead)

My URL example:
/lightning/o/Task/new?defaultFieldValues=
{!IF(ISBLANK(Lead.AccountId__c),'','WhatId='&Lead.AccountId__c)},
{!IF(ISBLANK(Lead.Primary_ContactId__c),'WhoId='&Lead.Id,'WhoId='&Lead.Primary_ContactId__c)},
Lead_Lookup__c={!Lead.Id}
&retURL=%2F{!Lead.Id},
backgroundContext=%2Flightning%2Fr%2FLead%2F{!Lead.Id}%2Fview

Regards,
VJ
As of Spring 20 release, we can again prepopulate field values using a URL - aka URL hacking (see release note here (https://releasenotes.docs.salesforce.com/en-us/spring20/release-notes/rn_general_lex_navigate_to_record_dfv.htm)).

I, for one, am so happy for this feature. However, there is one minor problem. When the URL is invoked, the new record modal pops up, and if the user chooses to Cancel, a blank page is displayed instead of returning to the page where the URL was called.

Below is the URL that I'm using. It is invoked with a custom list button located in a related list of an Opportunity.

/lightning/o/Case/new?defaultFieldValues=
AccountId={!Opportunity.AccountId},
Opportunity__c={!Opportunity.Id}

I've tried including a retunURL parameter - in different places in the URL. But no luck.