0

I have created a 2GP-managed package that includes an Apex class with SOQL queries. But from one SOQL query, which is on a custom object, I am unable to get the data for custom fields from that custom object. I am able to get standard fields from that same custom object. I am just getting blank fields in the Lightning data table.

enter image description here

​​​​​​​

9
  • 1
    - You may have not granted the appropriate field-level security for your custom fields in your package. You need to ensure that the profile or permission set that you are using to access the custom object has read access to the custom fields. Oct 30, 2023 at 9:57
  • Thank you for your respone @TusharJadav I have given read and write permissions for all custom fields on that custom object . But still iam facing that isssue.
    – samba
    Oct 30, 2023 at 11:40
  • Make sure that you have records on the custom object that you have queried into the apex. Oct 30, 2023 at 11:49
  • Yes I have records. I have added the Lightning data table screenshot in above. can you please check once.
    – samba
    Oct 30, 2023 at 13:46
  • @Phil W can you please help me on this.
    – samba
    Oct 30, 2023 at 14:01

1 Answer 1

0

In the Lightning Datatable Columns, you have missed to add your namespace to the API Name of the fields.

For Example, if your namespace is "testingabc". Any custom field added in the package will have api name as testingabc__fieldapiname__c.

Try adding the datatable columns like this:

[
{ 
      label: "Status", 
      fieldName: "namespace__Workbench_Status__c", 
      type: "text", 
      initialWidth: 180 
}, 
{ 
      label: "In Use", 
      fieldName: "namespace__Used__c", 
      type: "boolean", 
      initialWidth: 70 
}
]
1
  • Thank you So much @S1th Yeshwanth. It got resolved.
    – samba
    Oct 31, 2023 at 13:34

You must log in to answer this question.

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