Skip to main content
I am trying to access the value of propertyName of relatedobjects in js-meta.xml file so that i can access the value of this property and could retrieve the value for propertyName FieldNamejs-meta.xml file <?xml version="1.0" encoding="UTF-8"?>  <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="RelatedList">      <apiVersion>56.0</apiVersion>      <isExposed>true</isExposed>      <targets>          <target>lightning__RecordPage</target>      </targets>      <targetConfigs>        <targetConfig targets="lightning__RecordPage">              <property name="strTitle" type="String" label="Title" description="Enter the title"/>              <property name="objectApiName" type="String" label="Object Name" description="Enter the object name" datasource="apex://MyDynamicPickListExtension" />            <property name="relatedObjects" type="String" label="Related Objects" description="Enter the parent field API Name" datasource="apex://FetchLookupRelationship"/>            <property name="fieldName" type="String" label="Field Name" description="Enter the field name" datasource="apex://FetchTextFields"/>        </targetConfig>      </targetConfigs>  </LightningComponentBundle> javascript code : import { LightningElement, api, wire } from 'lwc';import getobjectName from '@salesforce/apex/FetchTextFields.getobjectName';    export default class RelatedList extends LightningElement {    @api objectApiName;    @api fieldName;    @api fieldValue;    @api relatedObjects;    @api recordId;    @api strTitle;    @api filterType;    relatedObjectsValue;     connectedCallback() {        if (this.relatedObjects) {            this.relatedObjectsValue = this.relatedObjects;        }    }     @wire(getobjectName, { relatedObjects: '$relatedObjectsValue' })     records({ error, data }) {        if (data) {            console.log('Result:', data);            // Do something with the result        } else if (error) {            console.error(error);        }    }     set relatedObjects(value) {        this.relatedObjectsValue = value;        console.log('relatedobjectsss--------->', this.relatedObjectsValue);    }} Apex code : global with sharing class FetchTextFields extends VisualEditor.DynamicPickList {     @AuraEnabled(cacheable=true)    public static string getobjectName( String relatedObjectsValue) {        string FetchTextField = relatedObjectsValue;        system.debug(fetchTextField);        if (FetchTextField != null) {        String objectApiName = Schema.getGlobalDescribe().get(FetchTextField).getDescribe().getName();        return objectApiName;    } else {        return null;    }    }} 
3 réponses
0/9000