+ Start a Discussion

Small doubt in code

The below class is given in pdf....but it is not saved...it shows errror....


Error: Compile Error: dimensions is not a fieldSet of Merchandise__c at line 7 column 8


Whata is this error ..how can i achieve it...


public class MerchandiseDetails {

public Merchandise__c merch { get; set; }

public MerchandiseDetails() {

this.merch = getMerchandise();


public List getFields() {

return SObjectType.Merchandise__c.FieldSets.Dimensions.getFields();


private Merchandise__c getMerchandise() {

String query = 'SELECT '; for(Schema.FieldSetMember f : this.getFields()) { query += f.getFieldPath() + ', '; } query += 'Id, Name FROM Merchandise__c LIMIT 1'; return Database.query(query); } }


For the above class v.f:


<apex:page controller="MerchandiseDetails">
<apex:form >
<apex:pageBlock title="Product Details">
<apex:pageBlockSection title="Product">
<apex:inputField value="{!merch.Name}"/>
<apex:pageBlockSection title="Dimensions">
<apex:repeat value="{!fields}" var="f">
<apex:inputField value="{!merch[f.fieldPath]}" required="{!OR(f.required, f.dbrequired)}"/>

Suresh RaghuramSuresh Raghuram

check u r merchandise__c object is having dimensions as a field or field set


am not having any dimensions field....and what is this field sets....