Wednesday, April 23, 2014

How to Extract Salesforce Record Ids From a Hyperlink

I recently found myself viewing a Salesforce report with fields that I wanted to update. But, I needed the id to do that. Unfortunately, the report was a standard report (in this case: HTLM Email Status), so my customization options were limited.



So, I copied and pasted the report data into Excel.

I needed a way to extract all the hyperlinks from the text so I could get to the record IDs in order to update. I followed the directions here to create a macro that extracted the hyperlinks.

Here's how it all came together: 


1. Paste hyperlinked text into Excel. Add a column for Extracted URL.



2. Navigate to Visual Basic Editor.





3. Create a new Module.



4. Paste the following code into the module. (Get the code here.)


5. Run the code.



6. After the hyperlink has been extracted, pull out the record id with a formula.




7. Expand the formula for all rows.


And that's it!

So, if you ever find yourself struggling to update records when you don't have the id accessible, but do have the hyperlink, now you'll know what to do.

2 comments:

  1. Jenna, your blog has been a godsend - just spent a couple hours going back to your 2011 posts - thank you! Lauren

    ReplyDelete
  2. Lauren, wow - thanks! I'm so glad that you found my random geeky ramblings useful. :)

    ReplyDelete