0

I am trying to display data that is being return by an API. On my system.debug I can see the data is there but on displaying on the page it only shows an array of the ids of the list object. This is the code to show it.

display.page

<apex:datatable value="{!dataArray}" var="data" styleclass="data-tbl" columnswidth="44%, 40%, 16%" headerclass="tbl--cell-header" rowclasses="odd,even">
 <apex:column >
        <apex:outputtext value="{!data}" />
 </apex:column>
 <apex:column >
        <apex:outputtext value="{!data.name}"  />
 </apex:column>
 <apex:column >
       <apex:outputtext value="{!data.title} : {!data.company}" />
 </apex:column>
 </apex:datatable>

Apex

public List<Data_Mapping__c> dataarray;

    public List<Data_Mapping__c> getdataarray() {

           // API call to get data
            dataArray = datafunctions.getData();

           // Shows actual data including id, name, title, column
            system.debug('@@@dataArray ' + dataarray);

            return dataarray;
        }

When I use system.debug('@@@dataArray ' + dataarray); it shows the output I want to use on page for example something like "{Data_Mapping__c: {Id: 123456abc, name: test, title: test-title, company: test-company}}" is on the user_debug log.

When I display dataArray on page it just shows [123456abd].

3
  • I think here you are facing issue due to FLS. Please check that logged-in user has access to the fields on Data_Mapping__c object. Check out this link to set FLS permission in Permission Sets and Profiles (developer.salesforce.com/docs/…) Commented Oct 31, 2018 at 16:54
  • I was able to do the able and my issue was solved. Thank you @PragatiJain
    – Dan C
    Commented Oct 31, 2018 at 17:26
  • I didn't get your mean. Commented Oct 31, 2018 at 17:46

2 Answers 2

0

apex:pageBlockTable and apex:dataTable require that any output be placed inside an apex:column.

<apex:datatable value="{!dataArray}" var="data" styleclass="data-tbl" columnswidth="44%, 40%, 16%" headerclass="tbl--cell-header" rowclasses="odd,even">
        <apex:column value="{!data}" />
        <apex:column value="{!data.name}"  />
       <apex:column value="{!data.title} : {!data.company}" />
 </apex:datatable>
1
  • I updated the code. The issue is i am getting data on my getdataarray() however. It is not transferring to page.
    – Dan C
    Commented Oct 31, 2018 at 16:29
0

I think here you are facing issue due to FLS. Please check that logged-in user has access to the fields on Data_Mapping__c object. Check out this link to set FLS permission in Permission Sets and Profiles (https://developer.salesforce.com/docs/atlas.en-us.securityImplGuide.meta/securityImplGuide/users_profiles_fls.htm)

1
  • This does not provide an answer to the question. You may like to post this as a comment and verify with the OP. And once confirmed by the OP, you can then roll this up as an answer with details.
    – Jayant Das
    Commented Oct 31, 2018 at 16:53

You must log in to answer this question.

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