0

Do you have to use the url data type to navigate to a sObject like how it is on list views?

For example, this is the data table which I want to refactor to use the base datatable lightning component:

enter image description here

We are using an HTML table with slds styling currently. I try to avoid hard coding urls when possible but it doesn't seem like this is possible currently. Am I missing something or is that how it is done.

1

The solution that I found is to use window.location.origin to get the protocol and hostname, something like this:

oppty.link= window.location.origin + '/one/one.app#/sObject/' + oppty.Id + '/view';

The only problem that I see with this solution is the Critical Update about Lightning URL format change.. but if you already activate it, then it should work until the next URL format change.

1

As of Summer '18, you can use lightning:navigation to navigate to a SObject record or other pages within Salesforce without having to hardcode URLs.

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.