Salesforce Lightning URL Hack - Clone Button (Viewer Request!)

Поділитися
Вставка
  • Опубліковано 26 лип 2024
  • Hey Salesforce Friends! 👋
    🗞️ Sign-up to the Part-Time Salesforce Academy newsletter here: www.adamfoyston.com/newsletter
    Here is the Custom URL used in the demo :)
    /lightning/o/Opportunity/new?defaultFieldValues=CampaignId={!Opportunity.CampaignId},AccountId={!Opportunity.AccountId}
    LINKS
    Start up you're own Trailhead account: trailhead.salesforce.com/
    FREE Salesforce Developer Org: developer.salesforce.com/signup
    Trailhead Career Paths: trailhead.salesforce.com/care...
    Timecodes
    0:00 - Intro & Overview
    3:03 - Use Case
    5:14 - Set Lookup Fields Values in Custom URL
    13:26 - Learn More/Outro
    If you found this video useful please subscribe for more videos like this every week!
    Also, let me know if you have any questions about Salesforce and/or there are any other videos you'd think would be good to make.
    May the Salesforce be with you! x
    Connect with me on LinkedIn: / adam-foyston-32148954
    Signup to my Newsletter!: newsletter.adamfoyston.com/
  • Навчання та стиль

КОМЕНТАРІ • 24

  • @Harshal-vo3sr
    @Harshal-vo3sr 2 роки тому +1

    You are amazing, you are my life saver..I created custom clone button on Opportunity which will clone associated Contract record.. Amazing you are

    • @AdamFoyston
      @AdamFoyston  2 роки тому +2

      You're welcome - glad I was able to help.

  • @simtahal
    @simtahal Рік тому

    Hey Adam! Thank you for this! is it possible to copy amount (currency) fields? I tired to do this for a custom button for cloning an opportunity however the values are not copying over.

  • @mgupta10
    @mgupta10 3 місяці тому

    Hi, can the date field be cloned using this hack? I’m not able to clone the date field. Getting an error it should be in format m/d/yyyy. I already have the correct format.

  • @Rootkit_69
    @Rootkit_69 2 роки тому +1

    Hi Adam, Can you suggest how to create a flow to override the button "Mark status as complete" button while moving the case to next status. I feel that it is creating an extra click to do that. Once user click on the status on path and the again has to click on "Mark status as complete". I wish it was a single go when user just click on status on path. Thank you.

    • @AdamFoyston
      @AdamFoyston  2 роки тому

      Hi there, great question. Unfortunately that's not possible. The way salesforce works with this standard feature, it will always require two clicks, either change status field value and click save, or click status in the chevrons and then the 'Mark as complete'. However, you can build a flow that will automatically set the status (or any other field value) and save it with one button click. Check out this video for how to build a flow with a 'Get Records' and 'Update Records' function: studio.ua-cam.com/users/videoQV0NT08W7OM/edit
      And then check this one out to learn how to fire the Flow on a custom button. That way a button can be created called 'Close Case' or 'Accept' (where you also change the owner), etc...: studio.ua-cam.com/users/video7egxs-VpTgY/edit
      Hope these help a bit.

  • @Sonic_Serendipity
    @Sonic_Serendipity 2 роки тому +1

    How we can handle a pick list value which have separated comma in URL hack?

    • @AdamFoyston
      @AdamFoyston  Рік тому

      Hi there, I think 'with difficulty'. You can't do any logic in the URL so you can only pass the value to another text field I think. It's not great. Maybe a flow can sort out the use case?

  • @hackersworld4244
    @hackersworld4244 2 роки тому +2

    @AdamFoyston Hi Adam Thanks for the video for my request. Here is the question is I try to apply this on custom lookup field at the time face some Error. This is a Salesforce Standard lookup field I'm right. Kindly Requested to check with custom lookup Field. Please Check it. Big Thanks for your Response . Regards Hackers World

    • @AdamFoyston
      @AdamFoyston  2 роки тому

      Hi there, I've found your question!
      So doing this on custom lookup,...it does work but I think the thing that you might want to check, is that the value you're referencing is in fact the ID field value. In other words, if the lookup is to a custom object, then you can't just use the reference for that field, you need to click into the field reference to see the fields within and search for the Record 'ID' field to pull in. That will then pass the actual ID to the custom lookup you're trying to set.
      See this example of the URL but with a custom lookup field called 'Custom Account Lookup'. I'm setting it to 'AccountID' but if the object is custom, again ,make sure you're drilling into the field on the object and the ID one: /lightning/o/Opportunity/new?defaultFieldValues=StageName=Qualification,CloseDate={!TEXT(TODAY()+30)},Custom_Account_Lookup__c={!Account.Id},LeadSource=Partner+Referral&saveURL=/{!Account.Id}

  • @vishwatej434
    @vishwatej434 Рік тому +1

    Is it possible to add a related list in the url? I want to clone the records with the related lists but I want to know if we can create one without a flow. It would be great if we can do that. Waiting for ur reply, thanks

    • @AdamFoyston
      @AdamFoyston  Рік тому

      Hello - unfortunately the URL is not very clever. You can't do any logic in it and nor can you do actions like that in it. You will have to use a flow I'm afraid. However, you should be able to do it with a few tutorials. Winter 23 now allows you to update related records directly, so check that feature out when it's GA. :)

    • @vishwatej434
      @vishwatej434 Рік тому

      @@AdamFoyston sure thank you!

  • @edawnbarber4221
    @edawnbarber4221 Рік тому +1

    Hi Adam, thank you for this. Brilliant! One question: if I am using this method, how would I write in a case record Id change as well? Something like this? RecordTypeId=(012DG00000EASdYAO)

    • @AdamFoyston
      @AdamFoyston  10 місяців тому

      Hi there, so record types are a bit tricky. You can do this I think (from memory) like this: /lightning/o/Opportunity/new?recordTypeId=0121U000000KDRIQA4&defaultFieldValues=AccountId={AccountIDValue}, etc, etc...

  • @hackersworld4244
    @hackersworld4244 2 роки тому +1

    Hi Adam any updates regarding my question

    • @mittureddy01
      @mittureddy01 2 роки тому +1

      Did you get this resolved? I have a custom lookup that I’m trying to clone its data to new record… but it is unable to pass the data. Let me know if you found a way around this

    • @AdamFoyston
      @AdamFoyston  2 роки тому

      Hi there, I think I did reply to your other post in another video, but if still needing help please repost here and I'll see if I'm able to (or at least guid in the right direction) :)

    • @hackersworld4244
      @hackersworld4244 2 роки тому

      @@mittureddy01 from URL hijacking it's not possible to pass the custom look up field so I'm using Custom VF page and get the record from Apex controller and override the VF page on Clone button

    • @AdamFoyston
      @AdamFoyston  2 роки тому

      Hi there, so you should be able to simply pass the id of the record you want to populate the lookup with the reparent/reconnect to another record. In classic, you had to faff around with a certain syntax but in Lightning, you can simply pass the ID. Although, if you are passing an ID, and it's hardcoded, please remember that you need to change the ID when you move to Production (as the record ID's will be different. Check out this video around 5mins for an example of me updating a lookup value (RecordType) with an ID. ua-cam.com/video/D65NggoDvvE/v-deo.html
      However, it depends on your use case. If you are trying to set the value of a lookup in a record to something that isn't stored in the record itself (i.e. you need to perform a search for a specific record, or even create a new record and set it to the ID of that new record) then I highlight recommend not to do a URL hack and instead do a custom button that launches a flow where you can do pretty much anything. Check this out for creating a simple flow (tweak it to what you want to do): ua-cam.com/video/QV0NT08W7OM/v-deo.html
      and this one for launching it from a custom button: ua-cam.com/video/7egxs-VpTgY/v-deo.html

    • @AdamFoyston
      @AdamFoyston  2 роки тому

      I replied to his/her other field, but here is my text:
      So doing this on custom lookup,...it does work but I think the thing that you might want to check, is that the value you're referencing is in fact the ID field value. In other words, if the lookup is to a custom object, then you can't just use the reference for that field, you need to click into the field reference to see the fields within and search for the Record 'ID' field to pull in. That will then pass the actual ID to the custom lookup you're trying to set.
      See this example of the URL but with a custom lookup field called 'Custom Account Lookup'. I'm setting it to 'AccountID' but if the object is custom, again ,make sure you're drilling into the field on the object and the ID one: /lightning/o/Opportunity/new?defaultFieldValues=StageName=Qualification,CloseDate={!TEXT(TODAY()+30)},Custom_Account_Lookup__c={!Account.Id},LeadSource=Partner+Referral&saveURL=/{!Account.Id}

  • @Bassurra
    @Bassurra 11 місяців тому +1

    I wanted to keep watching, but the background salsa fiesta music clashed with the undiagnosed spectrum disorder this video gave me.

    • @AdamFoyston
      @AdamFoyston  10 місяців тому +1

      Oh no! I'm sorry for that! Less music....got it :)