-1

I need to avoid hardcoding redirection urls. Is it possible?.I reffred below post Still I can able to see hardcod url in the ans:

Link to a record detail page from a Lightning Component

<td><lightning:formattedURL value="{!'/one/one.app?#/sObject/'+ userData.Id + 
         '/view'}" target="_blank" label="{!userData.Name}"/></td>
                        <td><lightning:formattedURL value="{!'/one/one.app? 
     #/sObject/'+ userData.Id + '/view'}" target="_blank" label=" 
         {!userData.User__r.Name}"/></td>

Issue 2:

Lets consider it as different context:

Trying to pass value to one more component.Getting below error:

This page has an error. You might just need to refresh it. Assertion Failed!: Provider type not supported : false Callback failed: apex://GSS_AddandCloneSkillsExtension/ACTION$getSelectedUserData Failing descriptor: {c:GSS_UserDataDetails}

      <aura:attribute name="UserdataList" type="List"/>
      <aura:iteration items="{!v.lstSelectedUserDataRec}" var="userData" >
                    <tr>
                        <c:GSS_UserDataDetails userData="{!userData}"/>

                    </tr>
  </aura:iteration>

GSS_UserDataDetails:

<aura:component implements="force:appHostable,flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId,forceCommunity:availableForAllPageTypes,force:lightningQuickAction" access="global" >
<aura:attribute name="userData" type="GSS_User_Data__c"/>
<td><lightning:formattedURL value="{!'/one/one.app?#/sObject/'+ userData.Id + '/view'}" target="_blank" label="{!userData.Name}"/></td>
<td><lightning:formattedURL value="{!'/one/one.app?#/sObject/'+ userData.Id + '/view'}" target="_blank" label="{!userData.User__r.Name}"/></td>

Instead of this Line.

   <c:GSS_UserDataDetails userData="{!userData}"/>

If I write below Line of code.It will work:

  <td><lightning:formattedURL value="{!'/one/one.app?#/sObject/'+ userData.Id + '/view'}" target="_blank" label="{!userData.Name}"/></td>
<td><lightning:formattedURL value="{!'/one/one.app?#/sObject/'+ userData.Id + '/view'}" target="_blank" label="{!userData.User__r.Name}"/></td>

1 Answer 1

1

Example 1

You can, and should whenever possible, use the <lightning:navigation> component to generate URLs and manage navigation for you. It does not cover all situations - for example, it doesn't support navigating to a Visualforce page while providing parameters - but it does support navigating to sObject view pages.

<lightning:navigation> is a service component, so you declare it in your markup, give it an aura:id, and then access it by that ID in JavaScript to call its public methods, generateUrl() and navigate().

Both methods take a PageReference object, and that documentation offers more examples than the Component Library linked above in the PageReference Types section. The specific PageReference type you want is this sort, for a record page:

{    
       "type": "standard__recordPage",
       "attributes": {
           "recordId": "001xx000003XXXXAAG",
           "objectApiName": "Account",
           "actionName": "view"
       }
}

Note that this component is available only in one.app containers.

Example 2

<td><lightning:formattedURL value="{!'/one/one.app?#/sObject/'+ userData.Id + '/view'}" target="_blank" label="{!userData.Name}"/></td>

This isn't valid because it's missing the v. value provider to access component attributes. That is the source of the error

Provider type not supported

2
  • Thanks david.can you please provide code snippet navigation componet refrring to my component Apr 14, 2019 at 16:40
  • 1
    @AnnappaPH There are extensive examples in the Lightning Component Library, linked in my answer.
    – David Reed
    Apr 14, 2019 at 16:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .