How can I get the SObject from a url? Sample url:



If you want to know the SObjectType of a given Id, you can just use a short Execute Anonymous script:


In Lightning, the standard approach is to use the force:hasRecordId, as outlined in this article. Basically, if you use this, your component will automatically have an attribute called recordId that you can use in your controller:

var recordId = component.get("v.recordId");

Even better, implementing this interface allows you to "hint" places where the component can be used in the Lightning App Builder.

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.