0

I have a visualforce page and controller that allows a user to make a clone of a record and all of its related records and associate a new contact (ie. copy a record for a new contact)

Everything is working as it should, and I am trying to display a list of the newly saved records after insert in a list view. Again I am able to loop through and display all fields as required (eg. new contact, new record Id) except for the Name field which is an auto-number.

Does the name field not get returned after an insert action? Am I missing something here?

Visualforce Code

<apex:pageBlockTable value="{!Clones}"
        var="Clone">
        <apex:column styleClass="link">
            <apex:outputLink value="{!URLFOR($Action.Object__c.View, Clone.Id)}">View</apex:outputLink>
        </apex:column>
        <apex:column value="{!Clone.Name}" />  //This doesn't display
        <apex:column value="{!Clone.Contact__c}" />
    </apex:pageBlockTable>

1 Answer 1

2

Apex Code only modifies the ID value on insert, and not any other fields. You will need to perform a query after your insert to get the new auto-number values that were generated.

You must log in to answer this question.

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