0

I am currently working on a Visualforce related list of ProjectTasks__c to put on the page layout of the related object Milestone__c, with an editable column for the status field, allowing users to change the status of the related ProjectTask__c record without having to go to the record itself to change the status.

I have tried tackling this a couple of different ways, and have gotten to a point where it is saving the page and the extension but it is not actually working on the page, on the page it appears that it will work, but when the Save button is clicked it brings to a message that says "Formula Expression is required on the action attributes."

Any help that could be given would be more than appreciated!

The vf page code that I have is as follows:

    <apex:page standardController="Milestone__c" extensions="TaskRelatedList">
<style>
.fewerMore { display:none;}
</style>
<apex:form >
    <apex:pageBlock id="PTs" title="Tasks To Be Completed">
        <apex:pageBlockButtons >
            <apex:commandButton action="{Save}" value="Save"/>
        </apex:pageBlockButtons>
        <apex:pageBlockTable value="{!PTs}" var="p" rendered="{!NOT(ISNULL(PTs))}">
            <apex:column value="{!p.TaskName__c}"/>
            <apex:column value="{!p.Active__c}"/>
            <apex:column value="{!p.TaskTeam__c}"/>
            <apex:column headerValue="Status"><apex:inputField value="{!p.Status__c}"/></apex:column>
            <apex:column value="{!p.TaskNumber__c}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
</apex:form>    
</apex:page>

And the Extension Class I have is:

public class TaskRelatedList {

    private List<ProgramTask__c> PTs;
    private Milestone__c MI;
    public TaskRelatedList(ApexPages.standardController controller) {
        this.MI= (Milestone__c)controller.getRecord();
    }
    public List<ProgramTask__c> getPTs()
        {
            PTs = [Select Id, Name, TaskName__c, Active__c, TaskTeam__c, Status__c, TaskNumber__c from ProgramTask__c where CurrentUserTask__c = TRUE AND Story__r.Id = :MI.Id ORDER BY TaskNumber__c ASC];
            return PTs;
        }
    public pageReference saveStatusChange(){
    update this.PTs;
    return null;
    }
}

Thank you so much for your help in advance!

0

The immediate error is that instead of:

<apex:commandButton action="{Save}" value="Save"/>

you need to use:

<apex:commandButton action="{!saveStatusChange}" value="Save"/>

where as any controller reference - property or method - needs to be referenced via "{! }" and the method must exist in the controller. (And be the method you want to invoke; a save method is automatically provided but that would only save the single Milestone__c record not the list of ProgramTask__c).

  • This worked perfect! Thank you so much for your help! It is now saving and doing everything I expected. – SFAdminChase Jul 16 '14 at 22:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.