function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Richa_LearningRicha_Learning 

VF page for Ideas

Hi,


I am geting an error that zone is missing. but i am defaulting that in Class but still error

 
Page:
<apex:page standardController="idea">
<apex:form >
<apex:pageBlock title="New Idea">
<apex:pageBlockButtons >
 <apex:commandButton action="{!Save}" value="Save"/>
 <apex:commandButton value="Cancel" action="{!Cancel}" />
</apex:pageBlockButtons>
<apex:pageBlockSection title="Idea Details" columns="1">
<apex:inputField style="width:250px" value="{!idea.title}"/>
<apex:inputField required="true" style="width:600px" value="{!idea.body}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
            

Class:

public with sharing class ideaExtension {
Private final Idea idea;
public ideaExtension(ApexPages.StandardController stdController) {
this.idea = (Idea)stdController.getRecord();
}
public String getCommunityId() {
return idea.CommunityId ='012G0000000nJvqINO';
}
}

 
ArmouryArmoury

The below changes should work..

#1. VF Page:
<apex:page standardController="idea" extensions="IdeaExtension">
#2. Apex class:
 
public with sharing class ideaExtension {
Private final Idea idea;
public ideaExtension(ApexPages.StandardController stdController) {
this.idea = (Idea)stdController.getRecord();
this.idea.CommunityId ='012G0000000nJvqINO';
}
}

 
Richa_LearningRicha_Learning
Thanks Satish ...but i am getting the same error.
ArmouryArmoury
I just tested and it worked fine.. Here is the complete code.. Change the CommunityId in the apex class as per your org..
 
<apex:page standardController="idea" extensions="IdeaExtension">
    <apex:form >
        <apex:pageBlock title="New Idea">
            <apex:pageBlockButtons >
                <apex:commandButton action="{!Save}" value="Save"/>
                <apex:commandButton value="Cancel" action="{!Cancel}" />
            </apex:pageBlockButtons>
            <apex:pageBlockSection title="Idea Details" columns="1">
                <apex:inputField style="width:250px" value="{!idea.title}"/>
                <apex:inputField required="true" style="width:600px" value="{!idea.body}"/>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>
 
public with sharing class ideaExtension {
    Private final Idea idea;
    public ideaExtension(ApexPages.StandardController stdController) {
        this.idea = (Idea)stdController.getRecord();
        this.idea.CommunityId ='09a90000000aveuAAA';
    }
}

 
Richa_LearningRicha_Learning
Thanks it worked. Curious to know,have you done customization to idea? I am looking to replicate this functionality
ArmouryArmoury
No.. I haven't.. You want to replicate the whole 'Idea' feature? Is it a requirement or for learning?
Richa_LearningRicha_Learning
Kinda learning :)