Apex Code
String queryFields = null;
for(Schema.FieldSetMember field : SObjectType.Task.FieldSets.Activity_Detail_Page.getFields()){
queryFields = (queryFields == null ? field.getFieldPath() : queryFields+', '+field.getFieldPath());
}
String query = 'Select '+queryFields+',Description from Task where Id=\''+activityId+'\'';
task = Database.query(query);
Page Code.
<apex:pageBlock id="Block1">
<apex:pageBlockSection title="Activity Detail" collapsible="False">
<apex:repeat value="{!$ObjectType.Task.FieldSets.Activity_Detail_Page}" var="field">
<apex:outputField value="{!Task[field.fieldPath]}" />
</apex:repeat>
</apex:pageBlockSection>
<apex:pageBlockSection columns="1">
<apex:outputfield value="{!task.Description}">
</apex:outputfield>
</apex:pageBlockSection>
</apex:pageBlock>
String queryFields = null;
for(Schema.FieldSetMember field : SObjectType.Task.FieldSets.Activity_Detail_Page.getFields()){
queryFields = (queryFields == null ? field.getFieldPath() : queryFields+', '+field.getFieldPath());
}
String query = 'Select '+queryFields+',Description from Task where Id=\''+activityId+'\'';
task = Database.query(query);
Page Code.
<apex:pageBlock id="Block1">
<apex:pageBlockSection title="Activity Detail" collapsible="False">
<apex:repeat value="{!$ObjectType.Task.FieldSets.Activity_Detail_Page}" var="field">
<apex:outputField value="{!Task[field.fieldPath]}" />
</apex:repeat>
</apex:pageBlockSection>
<apex:pageBlockSection columns="1">
<apex:outputfield value="{!task.Description}">
</apex:outputfield>
</apex:pageBlockSection>
</apex:pageBlock>
No comments:
Post a Comment