• Kerry McCourt
  • NEWBIE
  • 10 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 3
    Replies
I am trying to create a lightning component on the account record that shows active assets for that account. For some reason, it is showing me ALL assets on ALL account records. I followed the trailhead and got this to work for contacts, but not assets. 

Here is my class:
public class MyAssetListController {
    @AuraEnabled
    public static List<Asset> getAssets(Id recordID) {
        return [Select Id, Name, IsActive__c
        From Asset 
        Where (IsActive__c = TRUE) 
        AND AccountId = :recordID];
    }
}

 
I'm trying to create a VF page that will allow the sales team to edit multiple opportunity line items at the same time. My work compiles fine, but the save button doesn't actually edit any of the products. Anyone know what I'm doing wrong?

VF:
<apex:page standardController="Opportunity" extensions="OLIController" >
    <apex:form >
        <apex:pageBlock title="Opportunity Products">
            <apex:pageBlockTable var="OLI" value="{!OLIs}" id="newProduct">
                <apex:column value="{!OLI.name}"/>
                <apex:column headerValue="Product Family">
                    <apex:inputfield id="Product_Family__c" value="{!OLI.Product_Family__c}"/>
                </apex:column>
                <apex:column headerValue="Product Included in Sale">
                    <apex:inputfield id="Product_Included_in_Sale__c" value="{!OLI.Product_Included_in_Sale__c}"/>
                </apex:column> 
                <apex:column headerValue="Product Lost Reasons">
                    <apex:inputfield id="Product_Lost_Reasons__c" value="{!OLI.Product_Lost_Reasons__c}"/>
                </apex:column> 
                <apex:column headerValue="Product Gap Reason">
                    <apex:inputfield id="Product_Gap_Reason__c" value="{!OLI.Product_Gap_Reason__c}"/>
                </apex:column> 
                <apex:column headerValue="Competitor">
                    <apex:inputfield id="Competitor__c" value="{!OLI.Competitor__c}"/>
                </apex:column> 
            </apex:pageBlockTable>
            <apex:pageBlockButtons>
                <apex:commandButton value="Save" action="{!saveIt}"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Controller:
public with sharing class OLIController {

public ApexPages.StandardController sc;
public Opportunity Opp {get;set;}
public List<OpportunityLineItem> OLIlist2 {get ;set;}

public OLIController(ApexPages.StandardController sc) { 
this.Opp = (Opportunity)sc.getRecord();
OLIlist2 = [Select Name, ID, Product_Family__c, Product_Included_in_Sale__c, Product_Lost_Reasons__c, Product_Gap_Reason__c, Competitor__c, OpportunityId FROM OpportunityLineItem WHERE OpportunityId =:Opp.Id];
}


public List<OpportunityLineItem> getOLIs() {

    List<OpportunityLineItem> OLIlist2 = [Select Name, ID, Product_Family__c, Product_Included_in_Sale__c, Product_Lost_Reasons__c, Product_Gap_Reason__c, Competitor__c, OpportunityId FROM OpportunityLineItem WHERE OpportunityId =:Opp.Id];

    return OLIlist2;

}
public PageReference saveIt() {
   // List<OpportunityLineItem> listOLI = getOLIs();

    update OLIlist2;

    return null;

}
}
I am trying to add a new tab to my community topic detail page that is controlled by the topic itself. Specifically, I have different article types (Videos, FAQs) and I'd like to show them on different tabs. I created a visualforce page, but can't see to set the topic. The issue is that I need it to be dynamic, so when a user switches from topic to topic, they see different articles.

Here is the VF page:
<apex:page showheader="false" >
<apex:outputPanel layout="block">
 
 <knowledge:articleList articleVar="article" articleTypes="Videos__kav"> 
 <a style="font-size:20px; line-height:38px; font-family: Open Sans; font-weight:800; text-decoration:none; " href="{!URLFOR($Action.KnowledgeArticle.View, article.id)}">{!article.title}</a>
  <br />
 </knowledge:articleList>

   </apex:outputPanel>
 </apex:page>


How do I change this page so it recognizes which specific topic should be shown? Any help would be much appreciated.  
 
Hi Community,

I am trying to make a Visualforce table that will hold summed amounts. I want to have eight different SOQL queries that all use the SUM function, and then display them in a Visualforce table. 

Here's my controller so far:

public class PipelineController {
  
   public list<AggregateResult> newBizAmt = new list<AggregateResult>();
    public PipelineController(){
        newBizAmt = [select SUM(Amount) nba,RecordTypeForm__c 
                     from Opportunity 
                     WHERE RecordTypeForm__c = 'New Business' 
                     AND Current_Quarter__c = 'Q2-2016' 
                     AND isClosed = FALSE
                     GROUP BY RecordTypeForm__c];
    }
    public list<WrpClass> getResults(){
        list<WrpClass> nbaResults = new list <WrpClass>();
        for(AggregateResult ba:newBizAmt){
            WrpClass objwc = new WrpClass(ba);
            nbaResults.add(objwc);
        }
        return nbaResults;
    }
    class WrpClass{
        public Double Amount{get;set;}
        public WrpClass(AggregateResult ba){
            Amount=(Double)ba.get('nba');
        }
    }
}

I've been trying to display the result in a Visualforce page, but am having issues. Here's what I have:

<apex:page controller="PipelineController">
   <apex:pageBlock title="Sales Pipeline">
       <apex:pageBlockTable value ="{!results}" var="item">
        <apex:column value="{!nbaResults"/>
       </apex:pageBlockTable>
   </apex:pageBlock> 
</apex:page>


Could anyone help point me in the right direction? I know my column value is incorrect, but I'm not sure what to edit to make it work. Any help would be appreciated. 
I'm trying to create a VF page that will allow the sales team to edit multiple opportunity line items at the same time. My work compiles fine, but the save button doesn't actually edit any of the products. Anyone know what I'm doing wrong?

VF:
<apex:page standardController="Opportunity" extensions="OLIController" >
    <apex:form >
        <apex:pageBlock title="Opportunity Products">
            <apex:pageBlockTable var="OLI" value="{!OLIs}" id="newProduct">
                <apex:column value="{!OLI.name}"/>
                <apex:column headerValue="Product Family">
                    <apex:inputfield id="Product_Family__c" value="{!OLI.Product_Family__c}"/>
                </apex:column>
                <apex:column headerValue="Product Included in Sale">
                    <apex:inputfield id="Product_Included_in_Sale__c" value="{!OLI.Product_Included_in_Sale__c}"/>
                </apex:column> 
                <apex:column headerValue="Product Lost Reasons">
                    <apex:inputfield id="Product_Lost_Reasons__c" value="{!OLI.Product_Lost_Reasons__c}"/>
                </apex:column> 
                <apex:column headerValue="Product Gap Reason">
                    <apex:inputfield id="Product_Gap_Reason__c" value="{!OLI.Product_Gap_Reason__c}"/>
                </apex:column> 
                <apex:column headerValue="Competitor">
                    <apex:inputfield id="Competitor__c" value="{!OLI.Competitor__c}"/>
                </apex:column> 
            </apex:pageBlockTable>
            <apex:pageBlockButtons>
                <apex:commandButton value="Save" action="{!saveIt}"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Controller:
public with sharing class OLIController {

public ApexPages.StandardController sc;
public Opportunity Opp {get;set;}
public List<OpportunityLineItem> OLIlist2 {get ;set;}

public OLIController(ApexPages.StandardController sc) { 
this.Opp = (Opportunity)sc.getRecord();
OLIlist2 = [Select Name, ID, Product_Family__c, Product_Included_in_Sale__c, Product_Lost_Reasons__c, Product_Gap_Reason__c, Competitor__c, OpportunityId FROM OpportunityLineItem WHERE OpportunityId =:Opp.Id];
}


public List<OpportunityLineItem> getOLIs() {

    List<OpportunityLineItem> OLIlist2 = [Select Name, ID, Product_Family__c, Product_Included_in_Sale__c, Product_Lost_Reasons__c, Product_Gap_Reason__c, Competitor__c, OpportunityId FROM OpportunityLineItem WHERE OpportunityId =:Opp.Id];

    return OLIlist2;

}
public PageReference saveIt() {
   // List<OpportunityLineItem> listOLI = getOLIs();

    update OLIlist2;

    return null;

}
}
Hi Community,

I am trying to make a Visualforce table that will hold summed amounts. I want to have eight different SOQL queries that all use the SUM function, and then display them in a Visualforce table. 

Here's my controller so far:

public class PipelineController {
  
   public list<AggregateResult> newBizAmt = new list<AggregateResult>();
    public PipelineController(){
        newBizAmt = [select SUM(Amount) nba,RecordTypeForm__c 
                     from Opportunity 
                     WHERE RecordTypeForm__c = 'New Business' 
                     AND Current_Quarter__c = 'Q2-2016' 
                     AND isClosed = FALSE
                     GROUP BY RecordTypeForm__c];
    }
    public list<WrpClass> getResults(){
        list<WrpClass> nbaResults = new list <WrpClass>();
        for(AggregateResult ba:newBizAmt){
            WrpClass objwc = new WrpClass(ba);
            nbaResults.add(objwc);
        }
        return nbaResults;
    }
    class WrpClass{
        public Double Amount{get;set;}
        public WrpClass(AggregateResult ba){
            Amount=(Double)ba.get('nba');
        }
    }
}

I've been trying to display the result in a Visualforce page, but am having issues. Here's what I have:

<apex:page controller="PipelineController">
   <apex:pageBlock title="Sales Pipeline">
       <apex:pageBlockTable value ="{!results}" var="item">
        <apex:column value="{!nbaResults"/>
       </apex:pageBlockTable>
   </apex:pageBlock> 
</apex:page>


Could anyone help point me in the right direction? I know my column value is incorrect, but I'm not sure what to edit to make it work. Any help would be appreciated.