In my org there is a record on a custom object which on creation populates a URL on a path field : /lightning/r/Account/0012w000019tsbCAAQ/edit

From the above mentioned URL I need the record Id to store it in a separate field. I have tried using formula field to retrieve the record Id but not sure what to do when the object name in the url is dynamic

Formula field which I created:

LEFT(RIGHT(Path__c, LEN(Path__c) - 21),18)

This removes '/lightning/r/Account/' & 'edit' but how can I make the formula dynamic depending on the type of object

1 Answer 1


Use SUBSTITUTE to get rid of constant /edit, then take rightmost 18 chars


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.