• A9865
  • NEWBIE
  • 10 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies
I would like to filter the column "Status" of my table by selecting a value in a pick list which is integrated in the column header:
 
<table class="list" border="0" cellpadding="0" cellspacing="0" id="maintable">
    <thead class="rich-table-thead">
        <tr class="headerRow">
            <th class="headerRow"> Name</th>
            <th class="headerRow">Status &nbsp;&nbsp;                               
                <apex:selectList id="searchStatus" value="{!selectedStatus}" size="1" onchange="getlistDevRequests">
                    <apex:selectOptions value="{!Status}" />
                </apex:selectList></th>
            <th class="headerRow">Start Date</th>       
        </tr>
    </thead>
    <apex:repeat value="{!lstDevRequests}"  var="item">
        <tbody>
            <tr class="dataRow">
                <td>{!item.Name}</td>
                <td><span class="status" >{!item.Status__c}</span></td>
                <td><apex:outputText value="{0,date,MM/dd/yyyy}"> <apex:param value="{!item.Start_Date__c}" /> </apex:outputText></td>
            </tr>
        </tbody>
    </apex:repeat>
</table>
 
public with sharing class tableDevRequests {

    List<Dev_Request__c> lstDevRequests;
    public String selectedStatus{get;set;}


    public tableDevRequests() {

    }


    public List<SelectOption> getStatus() {
        List<SelectOption> statOptions= new List<SelectOption>();
        statOptions.add( new SelectOption('-1','--All Status--'));
        for( Dev_Request__c dev : [select Id,Status__c from Dev_Request__c ] ) {
            statOptions.add( new SelectOption(dev.Id,dev.Status__c)); /*SelectOption list takes two parameters one is value and other one is label .In this case account name as a label and Id is the value .*/
        }
        return statOptions;
    }



    public List<Dev_Request__c> getlstDevRequests() {
        if(lstDevRequests == null)
            lstDevRequests = [Select Id, Name, Assignee__c, Assignee__r.Name, Start_Date__c, Due_Date_QA__c, Estimated_Hours__c, Estimated_Completion_Date__c, Status__c, Overview__c, Parent_Dev_Request__c, (SELECT Id, WhatId, ActivityDAte, Owner.Name, Description, Status, Subject from Tasks) from Dev_Request__c];
        return lstDevRequests;
    }
}

How would I modify my code?
  • January 24, 2017
  • Like
  • 0
I have a "Add new Task" Button that should be displayed in every row of my visual force table via apex:repeat. The button leads to a rendered output panel, where a new task can be generated. When hitting the button in the according line, the field "Related To" of the new task should already be prefilled with the WhoId of the custom object that is queried within the Apex:repeat of the table.

Thus, how would I pass on the item.Id within the Apex repeat to the controller?
 
<apex:form >
    <apex:pageblock >
    <apex:pageMessages />

        <apex:outputpanel rendered="{!generateTask==false}">
            <table class="list" border="0" cellpadding="0" cellspacing="0" id="maintable">
                <thead>
                    <tr>
                        <th>Name</th>
                        <th>Start Date</th>
                        <th>New Task</th>
                    </tr>
                </thead>

                <apex:outputPanel id="tableData">
                    <apex:repeat value="{!lstDevRequests_edit}"  var="item">
                        <tbody>
                            <tr>
                                <td>{!item.Name}</td>
                                <td><apex:outputText value="{0,date,MM/dd/yyyy}"> <apex:param value="{!item.Start_Date__c}" /> </apex:outputText></td>
                                <td><apex:commandButton action="{!generateTask}" value="New Task" id="newTaskButton"/></td>
                            </tr>
                        </tbody>
                    </apex:repeat>
                </apex:outputPanel>
            </table>
        </apex:outputpanel> 

        <apex:pageBlockSection title="Create New Task" columns="2" collapsible="false" rendered="{!generateTask==true}" >
            <apex:pageBlockSectionitem >
                    <apex:outputLabel value="Assigned To"/>
                    <apex:inputField value="{!insertnewTask.OwnerId}"/>
            </apex:pageBlockSectionitem>
            <apex:pageBlockSectionitem >
                    <apex:outputLabel value="Subject"/>
                    <apex:inputField value="{!insertnewTask.Subject}"/>
            </apex:pageBlockSectionitem>
            <apex:pageBlockSectionitem >
                    <apex:outputLabel value="Related To"/>
                    <apex:inputField value="{!insertnewTask.WhatId}"/>
            </apex:pageBlockSectionitem>         
        </apex:pageBlockSection>

    </apex:pageblock>
</apex:form>
 
public with sharing class tableRequests {
public List<Dev_Request__c> lstDevRequests_edit {get; set;}
public Task insertnewTask {get;set;}
public boolean generateTask {get;set;}



public tableRequests() {
    generateTask = false;
    lstDevRequests_edit = lstDevRequests_edit();
    insertnewTask = getnewTask();
}

public List<Dev_Request__c> lstDevRequests_edit() {
    if(lstDevRequests_edit == null)
        lstDevRequests_edit = [Select Id, Name, Assignee__c, Assignee__r.Name, Start_Date__c, Due_Date_QA__c, Estimated_Hours__c, Estimated_Completion_Date__c, Status__c, Overview__c, Parent_Dev_Request__c, (SELECT Id, WhatId, ActivityDAte, Owner.Name, Description, Status, Subject from Tasks) from Dev_Request__c];
    return lstDevRequests_edit;
}

public Task getnewTask() {
    Task newTask = new Task();
        newTask.WhatId = 'a0626000000EGH1AAO'; // This needs to be profiled with the corresponding item.Id
    return newTask;
}

public PageReference generateTask(){
    generateTask = true;
    return null;
}
}

Thank you for your help!
  • January 24, 2017
  • Like
  • 0
I have the problem that my editable table does not update when I hit the "save" button. I tried inline editing and normal editing, nothing would save. Although I referred to a standard controller, I prefer the solution with a custom controller.
 
<apex:page standardController="Dev_Request__c" extensions="tableDevRequest_edit">
    <apex:form >
        <apex:pageblock mode="inlineEdit"> 
            <apex:pageMessages />  
            <apex:pageBlockButtons > 
            <!--<apex:commandButton value="Save" action="{!saveTable}" id="saveButton" rendered="{!editTable==true}" immediate="true"/>-->
            <apex:commandButton value="Save" action="{!saveTable}" id="saveButton" immediate="true"/>
            <apex:commandButton id="cancelButton" value="Cancel"/> 
            </apex:pageBlockButtons>  

             <apex:pageblocktable value="{!lstDevRequest_edit}"  var="item">
                    <apex:column headerValue="Dev Request Name"><apex:actionRegion ><apex:outputField value="{!item.Name}"><apex:inlineEditSupport event="ondblClick" showOnEdit="saveButton,cancelButton" /></apex:outputField></apex:actionRegion></apex:column>
                    <apex:column headerValue="Id"><apex:outputField value="{!item.Id}"/></apex:column>
                    <apex:column headerValue="Status"><apex:inputField value="{!item.Status__c}"/></apex:column>
                    <apex:column headerValue="Start Date"><apex:inputField value="{!item.Start_Date__c}"/></apex:column>
                    <apex:column headerValue="Due Date QA"><apex:inputField value="{!item.Due_Date_QA__c}"/></apex:column>
                    <apex:column headerValue="Estimated Hours"><apex:inputField value="{!item.Estimated_Hours__c}"/></apex:column>
                    <apex:column headerValue="Assignee"><apex:inputField value="{!item.Assignee__c}"/></apex:column>
                    <apex:column headerValue="Overview"><apex:inputField value="{!item.Overview__c}"/></apex:column>
             </apex:pageblocktable>

        </apex:pageblock>
    </apex:form>
 
public with sharing class tableDevRequest_edit {

   public List<Dev_Request__c> lstDevRequest_edit {get;set;}

    public tableDevRequest_edit(ApexPages.StandardController controller) {
        lstDevRequest_edit = [Select Id, Name, Assignee__c, Assignee__r.Name, Start_Date__c, Due_Date_QA__c, Estimated_Hours__c, Estimated_Completion_Date__c, Status__c, Overview__c from Dev_Request__c];
    }

    public PageReference saveTable() {
        try {
            update lstDevRequest_edit;
        }   
        catch(Exception e){
            System.debug('Exception occurred '+String.valueOf(e));
        }
        return NULL;
    }     
}

Thank you for helping!
  • January 23, 2017
  • Like
  • 0
Within my Salesforce.com application, a user gets redirected to the SF organisation community when he opens a specific tab. So far the user needs to log in into the community once the browser tries to open the community url. 

I have tried to pass the parameters within the url with the SessionId, PortalId/CommunityId and the OrgId but I still got prompted to login. I constructed the link used in the Visualforce controller like:
"https://fullsand-...-portal.cs1.force.com/.../s/secur/frontdoor.jsp?sid=...0&orgId=...&portalId=..."

Furthermore I tried SSO, but that also would not help as also the SF login screen would appear which I want to suppress. I used the following to set up SSO:
  • Issuer = Salesforce.org domain
  • Entity ID = Community Link
  • Service Provider Initiated Request Binding = HTTP POST
When I use the SAML Validator, I get these messages:
  • Unable to parse the response
  • Premature end of file
  • Unable to map the subject to a Salesforce.com user
I read through all resources available on the net, but they seem not to have a direct answer to my question. So I would highly appreciate some help and support - thank you in advance!
  • January 04, 2017
  • Like
  • 0
I have a "Add new Task" Button that should be displayed in every row of my visual force table via apex:repeat. The button leads to a rendered output panel, where a new task can be generated. When hitting the button in the according line, the field "Related To" of the new task should already be prefilled with the WhoId of the custom object that is queried within the Apex:repeat of the table.

Thus, how would I pass on the item.Id within the Apex repeat to the controller?
 
<apex:form >
    <apex:pageblock >
    <apex:pageMessages />

        <apex:outputpanel rendered="{!generateTask==false}">
            <table class="list" border="0" cellpadding="0" cellspacing="0" id="maintable">
                <thead>
                    <tr>
                        <th>Name</th>
                        <th>Start Date</th>
                        <th>New Task</th>
                    </tr>
                </thead>

                <apex:outputPanel id="tableData">
                    <apex:repeat value="{!lstDevRequests_edit}"  var="item">
                        <tbody>
                            <tr>
                                <td>{!item.Name}</td>
                                <td><apex:outputText value="{0,date,MM/dd/yyyy}"> <apex:param value="{!item.Start_Date__c}" /> </apex:outputText></td>
                                <td><apex:commandButton action="{!generateTask}" value="New Task" id="newTaskButton"/></td>
                            </tr>
                        </tbody>
                    </apex:repeat>
                </apex:outputPanel>
            </table>
        </apex:outputpanel> 

        <apex:pageBlockSection title="Create New Task" columns="2" collapsible="false" rendered="{!generateTask==true}" >
            <apex:pageBlockSectionitem >
                    <apex:outputLabel value="Assigned To"/>
                    <apex:inputField value="{!insertnewTask.OwnerId}"/>
            </apex:pageBlockSectionitem>
            <apex:pageBlockSectionitem >
                    <apex:outputLabel value="Subject"/>
                    <apex:inputField value="{!insertnewTask.Subject}"/>
            </apex:pageBlockSectionitem>
            <apex:pageBlockSectionitem >
                    <apex:outputLabel value="Related To"/>
                    <apex:inputField value="{!insertnewTask.WhatId}"/>
            </apex:pageBlockSectionitem>         
        </apex:pageBlockSection>

    </apex:pageblock>
</apex:form>
 
public with sharing class tableRequests {
public List<Dev_Request__c> lstDevRequests_edit {get; set;}
public Task insertnewTask {get;set;}
public boolean generateTask {get;set;}



public tableRequests() {
    generateTask = false;
    lstDevRequests_edit = lstDevRequests_edit();
    insertnewTask = getnewTask();
}

public List<Dev_Request__c> lstDevRequests_edit() {
    if(lstDevRequests_edit == null)
        lstDevRequests_edit = [Select Id, Name, Assignee__c, Assignee__r.Name, Start_Date__c, Due_Date_QA__c, Estimated_Hours__c, Estimated_Completion_Date__c, Status__c, Overview__c, Parent_Dev_Request__c, (SELECT Id, WhatId, ActivityDAte, Owner.Name, Description, Status, Subject from Tasks) from Dev_Request__c];
    return lstDevRequests_edit;
}

public Task getnewTask() {
    Task newTask = new Task();
        newTask.WhatId = 'a0626000000EGH1AAO'; // This needs to be profiled with the corresponding item.Id
    return newTask;
}

public PageReference generateTask(){
    generateTask = true;
    return null;
}
}

Thank you for your help!
  • January 24, 2017
  • Like
  • 0
I have the problem that my editable table does not update when I hit the "save" button. I tried inline editing and normal editing, nothing would save. Although I referred to a standard controller, I prefer the solution with a custom controller.
 
<apex:page standardController="Dev_Request__c" extensions="tableDevRequest_edit">
    <apex:form >
        <apex:pageblock mode="inlineEdit"> 
            <apex:pageMessages />  
            <apex:pageBlockButtons > 
            <!--<apex:commandButton value="Save" action="{!saveTable}" id="saveButton" rendered="{!editTable==true}" immediate="true"/>-->
            <apex:commandButton value="Save" action="{!saveTable}" id="saveButton" immediate="true"/>
            <apex:commandButton id="cancelButton" value="Cancel"/> 
            </apex:pageBlockButtons>  

             <apex:pageblocktable value="{!lstDevRequest_edit}"  var="item">
                    <apex:column headerValue="Dev Request Name"><apex:actionRegion ><apex:outputField value="{!item.Name}"><apex:inlineEditSupport event="ondblClick" showOnEdit="saveButton,cancelButton" /></apex:outputField></apex:actionRegion></apex:column>
                    <apex:column headerValue="Id"><apex:outputField value="{!item.Id}"/></apex:column>
                    <apex:column headerValue="Status"><apex:inputField value="{!item.Status__c}"/></apex:column>
                    <apex:column headerValue="Start Date"><apex:inputField value="{!item.Start_Date__c}"/></apex:column>
                    <apex:column headerValue="Due Date QA"><apex:inputField value="{!item.Due_Date_QA__c}"/></apex:column>
                    <apex:column headerValue="Estimated Hours"><apex:inputField value="{!item.Estimated_Hours__c}"/></apex:column>
                    <apex:column headerValue="Assignee"><apex:inputField value="{!item.Assignee__c}"/></apex:column>
                    <apex:column headerValue="Overview"><apex:inputField value="{!item.Overview__c}"/></apex:column>
             </apex:pageblocktable>

        </apex:pageblock>
    </apex:form>
 
public with sharing class tableDevRequest_edit {

   public List<Dev_Request__c> lstDevRequest_edit {get;set;}

    public tableDevRequest_edit(ApexPages.StandardController controller) {
        lstDevRequest_edit = [Select Id, Name, Assignee__c, Assignee__r.Name, Start_Date__c, Due_Date_QA__c, Estimated_Hours__c, Estimated_Completion_Date__c, Status__c, Overview__c from Dev_Request__c];
    }

    public PageReference saveTable() {
        try {
            update lstDevRequest_edit;
        }   
        catch(Exception e){
            System.debug('Exception occurred '+String.valueOf(e));
        }
        return NULL;
    }     
}

Thank you for helping!
  • January 23, 2017
  • Like
  • 0
Within my Salesforce.com application, a user gets redirected to the SF organisation community when he opens a specific tab. So far the user needs to log in into the community once the browser tries to open the community url. 

I have tried to pass the parameters within the url with the SessionId, PortalId/CommunityId and the OrgId but I still got prompted to login. I constructed the link used in the Visualforce controller like:
"https://fullsand-...-portal.cs1.force.com/.../s/secur/frontdoor.jsp?sid=...0&orgId=...&portalId=..."

Furthermore I tried SSO, but that also would not help as also the SF login screen would appear which I want to suppress. I used the following to set up SSO:
  • Issuer = Salesforce.org domain
  • Entity ID = Community Link
  • Service Provider Initiated Request Binding = HTTP POST
When I use the SAML Validator, I get these messages:
  • Unable to parse the response
  • Premature end of file
  • Unable to map the subject to a Salesforce.com user
I read through all resources available on the net, but they seem not to have a direct answer to my question. So I would highly appreciate some help and support - thank you in advance!
  • January 04, 2017
  • Like
  • 0