• Regular Contributor
  • NEWBIE
  • 25 Points
  • Member since 2010

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 7
    Replies

Hi,

     I have a controller that gives the properties of Ideas object that is Body, categories, Id, etc.

I need to access the categories property for each Idea retrieved by the getIdeaList(); method so that i can have a different display  for ideas of some particular category.

I am able to control the display when i go by individual category.

I am unable to access that property retrived by the method.

I have copied the snippet of my code below: (both the page and the controller)

 

Visualforce Page:


<apex:dataList value="{!ideasWithVotes}" var="ideaWithVote" styleClass="ibtIdeaList ibtIdeaListPadding">
                            <c:ideaDetails idea="{!ideaWithVote.idea}" howUserVoted="{!ideaWithVote.howUserVoted}" returnUrl="  {!currentPageUrl}" />

</apex:dataList>

 

Controller:

 

public IdeaWithVote[ ] ideasWithVotes {
        get {
            if (ideasWithVotes == null) {
                ideasWithVotes = IdeaWithVote.getIdeasWithVotes(getIdeas());
            }
            return ideasWithVotes;
        }
        set;
    }
    
    public String[ ] cat {get;set;}
    
    public Idea[ ] getIdeas() {
        if (ideas == null) {
            if (controller != null) {
                ideas = controller.getIdeaList();
            }
        }    
        return ideas;
    }

 

Can anyone help me with this isuue.

 

Thanks in Advance

Hi,

     I have two custom objects with a master detail-relationship. I have a approval process that updates status the field on the detail object to 'Approved' once the record is approved by the manager. When the status is updated to approved, I have a workflow rule on the detail object to update the status on the Master object. According to my process, when the status on the detail object is changed to approved, the status on the master object should be updated to 'Certified'. But the field update workflow is not working accordingly. 

      The workflow rule criteria is Detail object :Status equals Approved.

 

Can anyone help me with this issue.

 

Thanks in advance.

I have a custom object called Headings and a junction object between Headings & Opportunites called Opportunity Headings.  (Headings and Opportunites have a many-to-many relationship).

 

I'm trying to create a trigger that will create a new Opportunity Headings record when a new Opportunity is created using the Heading referenced in a lookup field called Main_Heading__c on the Opportunity,.

 

I've done something very similar on another object with no problems, but when I modify that code for this object I get the following exception error:



Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger AddOppHdgtoRelatedList caused an unexpected exception, contact your administrator: AddOppHdgtoRelatedList: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Heading]: [Heading]: Trigger.AddOppHdgtoRelatedList: line 9, column 10


Here is the trigger I'm trying to use:


trigger AddOppHdgtoRelatedList on Opportunity (after insert){   
List<Opportunity_Headings__c> OHdg = new List<Opportunity_Headings__c>();            
for (Opportunity O : Trigger.new) {
                Opportunity_Headings__c OH = new Opportunity_Headings__c       
                (Heading__c = O.Main_Heading__r.id,
        Opportunity__c = O.ID, Account__c = O.Accountid
        );
        OHdg.add(OH);
    }    insert OHdg;


Please help!  I've been trying to fix this trigger for more than two weeks now with no luck.  It's telling me that the heading field is missing on the OH I'm trying to insert, but I have this in my code:  Heading__c = O.Main_Heading__r.id.  What am I doing wrong???

Not quite sure what I am missing, but I am getting an error :DML currently not allowed when I try to update the Case.

 

 

Anyone have any ideas? I get the DML error when i call update dupCases

 

here's a snippet of my code.

 

 

List<Case> dupCases = new List<Case>();

for(Case c : cases){
  if(c.Id != Master.Id){
    c.ParentId = Master.Id;
    dupCases.add(c);
  }
}

update dupCases;

 

 

Have seen similar posts and tried to follow the solution - but clearly I'm still missing something. Hoping one of you lovely people can help me out.

 

I am using an apex repeat to display a list of product details (using a custom class, not Product2). I want to be able to enter a value for Quantity and click on a commandlink to add a product from the list to a 'shopping cart'. I have no problem getting the outputtext data across, but cannot get the value I entered in the inputtext Quantity field.

A posted solution was to use custom getters/setter methods; I tried this and can indeed see my entered value in the debug log. So far so good, however I cannot figure out how to access this in my code!

 

Enough wittering, here's the code:

 

<apex:repeat value="{!mp_liAvailableProducts}" var="AvailableProd">
    <apex:commandLink action="{!actionAddProduct}" value="Add" id="theAddProductLink" >
        <apex:param name="AddProdId" value="{!AvailableProd.strProdId}" />
        <apex:param name="AddProdQuantity" value="{!AvailableProd.iProdQuantity}" />
    </apex:commandLink>
    <apex:inputText value="{!AvailableProd.iProdQuantity}" size="2" maxlength="2" />
        <a href="{!URLFOR($Action.Product2.View, AvailableProd.strProdId)}" target="_blank"> {!AvailableProd.strProdName} </a>
    <apex:outputText value="{!AvailableProd.strProdCode}" />
    <apex:outputText value="{!AvailableProd.strProdDesc}"/>
</apex:repeat>

 

 

    public class SPSelectProducts
    {
        public String    strProdId                            {get; set;}
        public String    strProdName                            {get; set;}
        public String    strProdCode                            {get; set;}
        public integer    iProdQuantity;
        public string    strProdDesc                            {get; set;}
       
        public SPSelectProducts(string ProductId, String ProductName, String ProductCode, integer ProductQuantity, string ProductDesc)
        {
            strProdId            = ProductId;
            strProdName            = ProductName;
            strProdCode            = ProductCode;
            iProdQuantity        = ProductQuantity;
            strProdDesc            = ProductDesc;
        }    

        // Custom setters for Quantity
        public integer getiProdQuantity()
        {
            return this.iProdQuantity;
        }

        public void setiProdQuantity(Integer value)
        {
            iProdQuantity = value;
            System.debug('****** Inside setter *****' + value);
        }    
    }

 

 

    public PageReference actionAddProduct()
    {
        SPSelectProducts sSPSP = m_mapAvailProds.get(ApexPages.currentPage().getParameters().get('AddProdId'));
        sSPSP.iProdQuantity = integer.valueOf(ApexPages.currentPage().getParameters().get('AddProdQuantity'));

 

 

At this point the 'AddProdQuantity' parameter is 0, which is why I went down the getter/setter method route.

The list mp_liAvailableProducts has all the product details with Quantity = 0.

Yet the ****** Inside setter ***** debug statement shows the value I entered in the list. This method is called once for each entry in the list, my entered value appears in the correct iteration.

 

Thanks in advance for your help,

Cheers

Mike

  • October 15, 2010
  • Like
  • 0

Hi,

     I have a controller that gives the properties of Ideas object that is Body, categories, Id, etc.

I need to access the categories property for each Idea retrieved by the getIdeaList(); method so that i can have a different display  for ideas of some particular category.

I am able to control the display when i go by individual category.

I am unable to access that property retrived by the method.

I have copied the snippet of my code below: (both the page and the controller)

 

Visualforce Page:


<apex:dataList value="{!ideasWithVotes}" var="ideaWithVote" styleClass="ibtIdeaList ibtIdeaListPadding">
                            <c:ideaDetails idea="{!ideaWithVote.idea}" howUserVoted="{!ideaWithVote.howUserVoted}" returnUrl="  {!currentPageUrl}" />

</apex:dataList>

 

Controller:

 

public IdeaWithVote[ ] ideasWithVotes {
        get {
            if (ideasWithVotes == null) {
                ideasWithVotes = IdeaWithVote.getIdeasWithVotes(getIdeas());
            }
            return ideasWithVotes;
        }
        set;
    }
    
    public String[ ] cat {get;set;}
    
    public Idea[ ] getIdeas() {
        if (ideas == null) {
            if (controller != null) {
                ideas = controller.getIdeaList();
            }
        }    
        return ideas;
    }

 

Can anyone help me with this isuue.

 

Thanks in Advance

Hi,

     I have two custom objects with a master detail-relationship. I have a approval process that updates status the field on the detail object to 'Approved' once the record is approved by the manager. When the status is updated to approved, I have a workflow rule on the detail object to update the status on the Master object. According to my process, when the status on the detail object is changed to approved, the status on the master object should be updated to 'Certified'. But the field update workflow is not working accordingly. 

      The workflow rule criteria is Detail object :Status equals Approved.

 

Can anyone help me with this issue.

 

Thanks in advance.

Hi,

 

How do i lock an ideas in my portal so that users can no longer vote on the locked idea but can comment on it? can this be achived using a formula /validation rule? Any tips or formula :) is appreciated.

 

Thanks

  • March 30, 2010
  • Like
  • 0