Skip to main content

hi all, 

we are implementing custom component common links in the record page where every user can hit the link navigate to a different page instantly.  For that i created the cutom metadata type store the urls in cutom meta data type . but not working though as of now . 

 

here is the code snippet

apex clas:

public with sharing class CustomPSALinks {      @AuraEnabled      public static List <PSA_Links__mdt> getPSALinks()      {     return([Select id,MasterLabel,Long_URL__c from PSA_Links__mdt]);           } }

 

({ doInit: function(component, event, helper) {       component.set('v.mycolumns', [             {label: 'Label', fieldName: 'MasterLabel', type: 'text'},                 {label: 'Long Url', fieldName: 'Long_URL__c', type: 'URL'}             ]);      var action = component.get("c.getPSALinks");          action.setParams({         });     action.setCallback(this, function(response){   var results = response.getReturnValue();   alert (results);      var state = response.getState();   if (state === "SUCCESS") {            var label =      results.MasterLabel;         console.log( response.getReturnValue());              alert(label);   component.set('v.psalinks', label);          } });         $A.enqueueAction(action);     } })

 

<aura:component implements = "flexipage:availableForAllPageTypes,force:appHostable" controller = "CustomPSALinks" >        <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>        <aura:attribute name="psalinks" type="PSA_Links__mdt[]" default="" />       <aura:attribute name="mycolumns" type="List"/>          <div class="slds-p-around_medium" style="background-color:white;">     <b>PSA Links</b>       <br></br>                  <lightning:formattedUrl  value = "{!v.psalinks.Long_URL__c}" label = "{!v.psalinks.MasterLabel}" />       </div>     </aura:component>

7 件の回答
  1. 2021年9月14日 11:45

    Hi Keiji Otsubo

     

    Thank you so much for your help, iteration is working with a small modifications. You are really helped a lot . 

0/9000