How To: Create a Custom URL Button in Salesforce Lightning

Поділитися
Вставка
  • Опубліковано 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=OwnerId={!Account.OwnerId},AccountId={!Account.Id},CloseDate={!TEXT(TODAY()+30)},StageName=Qualification,ForecastCategoryName=Pipeline
    LINKS
    Spring 22 Preview Org Sign Up: www.salesforce.com/form/signu...
    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
    2:35 - Use Case
    5:11 - Create New Button
    7:34 - Custom URL for Lightning
    15:50 - Add Custom Button to Layout
    18:33 - Testing It Works!
    20:24 - 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
  • Навчання та стиль

КОМЕНТАРІ • 55

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

    Let me know if you find this useful! I've used these a lot to help speed up creation of records. Don't forget, you can do this for Standard and Custom Salesforce objects :)

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

    Very Useful Adam. Thanks for all these great videos that you are doing!!!. I am always waiting for a new video of yours.

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

      Glad you like them! Thanks for watching. Hopefully they all help in some way with you career/job.

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

    Really happy I stumbled on your Channel. Just great explaining videos… No more to say about that but… Thanks…

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

    Great video! Clear instructions. Thanks Adam

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

      You're welcome! Thanks for watching :)

  • @tamraranard-c9468
    @tamraranard-c9468 2 роки тому

    Excellent!

  • @nemosidebiz
    @nemosidebiz 6 місяців тому

    This was pretty informative.

  • @danielmanzuti6961
    @danielmanzuti6961 Рік тому +2

    Great video Adam,
    just to complement this solution, we can use one more variable in the URL for cases when you have more then 1 record type just add "useRecordTypeCheck=1" (Remember to use "&" for separate logic) for example:
    /lightning/o/Opportunity/new?defaultFieldValues=AccountId={!Account.Id}&useRecordTypeCheck=1
    Thanks for your instructions. 🙂

    • @user-ds2bh1fz6c
      @user-ds2bh1fz6c 4 місяці тому

      I was looking for a solution to auto-populate close date for a while, however I have created the new button, but the issue I have I only need this new button on creation of one type of opportunity record, lets call it Alpha ,out of 5.
      1. how whould I make this work, so when the users clicks New button from opportunity and select record type=alpha this autopolation to trigger?
      2. how will I make it work ehrn teh users choose new opportunity from account or contact related list?
      Could you please help me figure this out?
      Thanks

  • @rameeshar707
    @rameeshar707 4 місяці тому

    please make a video on how to customize urls through flow explaining the variables etc

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

    thank you!

  • @patrickj.trevenen1633
    @patrickj.trevenen1633 2 роки тому +1

    Thanks
    Nice video

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

      Most welcome, Patrick. Thanks for all your comments/feedback. Much appreciated. :)

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

    Thanks.

  • @ShubhamSharma-dg8tt
    @ShubhamSharma-dg8tt Рік тому

    HI Adam,
    I have a use case where we want to pre-populate fields on the lead conversion page such as account name based on the Account lookup field on lead object etc.

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

    Great video as usual! Could you do an explanation of a custom "new version" button where you clone a custom record object like a contract along with inserting a parent field value of the cloned record id into a lookup field?

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

      Cool idea! I'll add that to my list of content ideas. Thanks!

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

    Good video, almost got me what I needed.
    How could I set an Opportunity field value = to an Account field value?

  • @user-ds2bh1fz6c
    @user-ds2bh1fz6c 4 місяці тому

    Hi Adam, great video. I was looking for a solution to auto-populate close date for a while, however I have created the new button, but the issue I have I only need this new button on creation of one type of opportunity record, lets call it Alpha ,out of 5.
    1. how whould I make this work, so when the users clicks New button from opportunity and select record type=alpha this autopolation to trigger?
    2. how will I make it work ehrn teh users choose new opportunity from account or contact related list?
    Could you please help me figure this out?
    Thanks

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

    Thank you Adam, you saved me

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

    Adam, Do you have video on List button. I want to create new record from related list button and want to bypass record type selection by passing recordType Id as parameter in URL.

  • @DricaAle28
    @DricaAle28 9 місяців тому

    Can you add also a return url to the Account Id page?

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

    Hi Adam, Great Explanation. i have one scenario , need to clone a record in this time we passing some field values to null how can i do this. Please Reply as soon as possible. Thank you
    Scenario: In asset object when we clone a record pass some field values to null use URL Hijacking how can i do thi?

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

      Yes, absolutely
      I replied on your other comment. BEst was in Lightning (that I know of) is to instead create a 'new' record button that passes the values of the fields from the record you're in using the 'merge' field statement (curly brackets {}). Here is my example for cloning an Opportunity with only the Stage and CLose Date copied across: /lightning/o/Opportunity/new?defaultFieldValues=StageName={!Opportunity.StageName},CloseDate={!Opportunity.CloseDate}

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

    Hey Adam. If I wanted this button to go on my Opportunity so that it generates a record for a custom object - would I be able to pull information from this Opportunity's products into my new record? Or am I limited to data from the opportunity record only?

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

      Hi there, great question. It's only possible to get information/data from fields in the object you're in OR ones related that are Master records or connected via a lookup. But no, not for object fields that could have many records (one-to-many relationship) such as with Opportunity Products. What is it that you're trying to do exactly? You might be able to get some info through via a Rollup Summary or via a different method (e.g. a Flow that triggers after record creation)

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

    Thank you for this video. How do you just simply add a url: and not a button to an opportunity, but a true url: to a web page on the Opportunity screen?

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

      Hi Seneca (I'm a big fan of the Greek Seneca!),
      Great question. You can do it using either the custom URL field type, or a formula field and the HYPERTEXT() logic...here is an example from Google: trailhead.salesforce.com/trailblazer-community/feed/0D54S00000A8BP0SAN

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

    HI Adam, Any updates regarding my previous command.

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

      Yes, absolutely
      I replied on your other comment. BEst was in Lightning (that I know of) is to instead create a 'new' record button that passes the values of the fields from the record you're in using the 'merge' field statement (curly brackets {}). Here is my example for cloning an Opportunity with only the Stage and CLose Date copied across: /lightning/o/Opportunity/new?defaultFieldValues=StageName={!Opportunity.StageName},CloseDate={!Opportunity.CloseDate}

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

      ​ @Adam Foyston Thanks for your Replying. At the time of custom clone button in the URL I need to check if condition for the field and then assign the value because this is a lookup field [ if the field contain something then return value or the field is empty then set null ] i tried if condition to assign value but it's not working I think you give me a best solution for this and please reply with some sample if condition in URL. Thanks & Best Regard Tamil M
      ​ @Adam Foyston Hi, Regarding above query i found one solution but this also have some problem
      Custom_lookup_field__c={!IF(ISNULL(Asset.Custom_lookup_field__c),NULL,Asset.Custom_lookup_fieldId__c)}
      it will work perfetly once the condition is false but suppose the condition is true we cannot assign the field value as NULL
      can you please help me out there . Thanks

  • @mlhjr61
    @mlhjr61 5 місяців тому

    Anybody know how to modify the new case action in the view cases list or the new case button on the Services Case drop-down? I want to present only a those fields that are necessary to open a case. I created a global action that does what I want but I want to modify the New Case button/action in the locations I've mentioned. A cup of coffee if you can figure it out.

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

    Can you add conditional logic to the url hack? Also, why not just use predefined values for the custom button?

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

      Hi there,
      Unfortunately, it doesn't support conditional logic...it's because the button is essentially creating a URL, and like a URL, can't use IF statements and the such. The only way to get some form of 'logic' in there is to perhaps reference a formula field in the URL Hack. However, as with a lot of things, there might be a different way to achieve your goal. What is the detail of your use case for using logic in a custom button?
      In regards to using pre-defined values, of course. You can use set (hardcoded) values, but the risk with that is again, depending on use case, that your URL isn't dynamic,...i.e. doesn't work in the context of the record or user that clicks on it, which could be needed based on your use case.
      Hope that helps (if not confused you more)

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

    I'm gonna start saying button like you. It's sound cooler.

  • @jakobfries9078
    @jakobfries9078 9 місяців тому +1

    How can I use this to launch an external URL to another webpage, not in Salesforce?

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

      So you know what? I think you can just put the link in there straight, no Salesforce anything. For example, if you want them to go to the BBC Sport website, simply put the whole URL in (make sure you include the ) www.bbc.co.uk/sport

    • @jakobfries9078
      @jakobfries9078 9 місяців тому

      @@AdamFoyston thank you!

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

    Hi Adam, i want to try this on account to create a new contact record. We have 3 contact record types, i tried to create 3 individual buttons and assign to the 3 different page layouts, however each button always reverts to the default record type that my profile has set up (meaning regardless of the url of each button it the new contact is made with the default record type only)...is there a way around this?Thanks

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

      Hi there, try passing the record type ID in the URL too. That will prepopulate and set that. Although you need to do it before the default values bit. Here is an example URL: /lightning/o/Contact/new?recordTypeId=0123456789ABC&defaultFieldValues=
      Obviously replace the id in the example with the ID of your record type. Make sure you get the full length ID. Look at this link for help. Try it out and let me know how it goes. :)
      NOTE: If you deploy this button to another org in a change set, you'll need to put the new ID's generated for the Record Type ID in that destination org. :)

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

      @@AdamFoyston so for each specific button use an appropriate record type ID for that account record? e,g i want the contact button on the blue account to create a contact record which has a blue record type therefore i would need to use the following code /lightning/o/Contact/new?recordTypeId=0123456789ABC&defaultFieldValues=blue
      I am struggling to get the contact record type to formulate depending on the accounts record type at the moment when i use the button with the code i have given as an example
      thanks

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

      @@mineyours1110 No I meant the ID in the example needs to be that of your Contact Record ID...for example, lets say the Record Type ID for the 'Blue Account Contact' record is '012345678ABC', and the Record Type ID for the 'Red Account Contact' record is '876543210CBA'....your two buttons would look like:
      /lightning/o/Contact/new?recordTypeId=012345678ABC&defaultFieldValues=
      and
      /lightning/o/Contact/new?recordTypeId=876543210CBA&defaultFieldValues=
      The bit at the end (after defaultFieldValues=) is where you put the values you want on the fields of the Contact record - for example, defaultFieldValues=OwnerId={!Account.OwnerId} (this will set the Contact Record Owner field value to whoever the owner is on the Account your clicking the button from)
      hope this helps....

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

      Hi! So check out the answer to your question in my new video! ua-cam.com/video/D65NggoDvvE/v-deo.html

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

    How do you make the Details UI so neat and even?

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

      Hi there, for a standard object (and custom) just simply edit the layout (in classic mode) and add sections to group the fields (as well as rearrange. Note: You can do this in Lightning edit page, you need to edit the layout for the object (classic version). If it's a custom object, you can upgrade the Lightning Layout to 'Dynamic' and rearrange/add sections in Lightning as well as visibility filters - see my video 'It's Magic - Dynamic Layouts' video for more :)

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

      @@AdamFoyston Thanks for the reply Adam! I was referring to having the fields next to the field label instead of the field defaulting under the field label.

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

    Hi Adam! Great video, I just subscribed and I am very happy I found your channel. Would it be possible to do the same but to edit an existing record? instead of creating a new one?
    For example something like: /lightning/OpportunityID/edit?defaultFieldValues=StageName=Committed,CloseDate=9/30/2022

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

      Great question. To be honest I've not tried that but my guess is that you would have to pass the ID of the record in the URL so it knows which record to edit. I'm guessing you could do that dynamically using the merge field values in the URL edit screen. Hopefully you found a solution! You could try looking at the URL in edit screen to see how it's constructed too? Best of luck! :)

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

    Hey Adam, new to your channel and i absolutely love it so far! Well done. Question, I took your tutorial and ran with it! I got lots of things working however I am unable to get the value from a custom lookup relationship. For example: i have a custom object for Billing System. On the Opp I have a look up to the custom Billing System (1:1). I cant seem to get that to populate like the lookups for standard objects (Account, Campaign, etc).
    Sample URL
    /lightning/o/Opportunity/new?defaultFieldValues=
    AccountId={!Account.Id},
    Name=Test+Opp+{!TEXT(TODAY())},
    CloseDate={!TEXT(TODAY())},
    StageName=Plan,
    Description={!'This is a test Opp'},
    Billing_System__c={!Opportunity_Billing_System__c.Id}, *this is the line that is not working*
    Billing_System__c=Field Api name
    Opportunity_Billing_System__c=Custom Object API name
    Any help would be greatly appreciated!!! Keep up the good work!

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

      Thanks for the feedback and question! Sooooo if I'm getting this right, the URL is trying to create a new Opportunity (sending user to a new/blank Opp screen)....but it looks like you're trying to populate the Billing_System__c lookup on the Opportunity using a value that isn't populated yet (looks like you're referencing the same field on the Opportunity?). Where are you getting the Billing System ID from? Is it created before the Opportunity is? What object is the 'Opportunity_Billing_System__c.Id' coming from? The Account that the button is being clicked from? :?

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

    ​ @Adam Foyston Thanks for your Replying. At the time of custom clone button in the URL I need to check if condition for the field and then assign the value because this is a lookup field [ if the field contain something then return value or the field is empty then set null ] i tried if condition to assign value but it's not working I think you give me a best solution for this and please reply with some sample if condition in URL. Thanks & Best Regard Tamil M
    ​ @Adam Foyston Hi, Regarding above query i found one solution but this also have some problem
    Custom_lookup_field__c={!IF(ISNULL(Asset.Custom_lookup_field__c),NULL,Asset.Custom_lookup_fieldId__c)}
    it will work perfetly once the condition is false but suppose the condition is true we cannot assign the field value as NULL
    can you please help me out there . Thanks.

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

      No worries. Hope I answered your other question.