You need to sign in to do that
Don't have an account?
sumanth kumar 26
Hyperlink action
Hello Developers...I have a custom object named Products and it is displayed as list. When I click on the name field under list, it should navigate to the detail page and it can be achieved using Hyperlink method. Can anyone suggest how to do that.
Thanks in advance
Sumanth Kumar
Thanks in advance
Sumanth Kumar
try this .
All Answers
Try the below demo code for your object. Let us know if this works.
public class WorkOrderController {
public list<Product2__C> productList {get; set;}
public Product2__C productFamily {get; set;}
public Work_Order__C workOrder { get; set; }
public list<Work_Order_Item__c> workItemList {get; set;}
public WorkOrderController() {
Id wID = ApexPages.currentPage().getParameters().get('wID');
workOrder = (wID == null) ? new Work_Order__C() :
[SELECT Account__c, Service_Date__c, Status__c FROM Work_Order__C WHERE Id = :wID];
}
public void Productlist() {
Id pID = ApexPages.currentPage().getParameters().get('pID');
productFamily = (pID == null) ? new Product2__c() :
[SELECT Family__c FROM Product2__c WHERE Id = :pID];
}
public List<Product2__c> getProducts()
{
productList = [select Name, Family__c, Measurement_Type__c, Cleaning_Unit_Price__c, Treatment_Unit_Price__c from Product2__c];
return productList;
}
public List<Work_Order_Item__c> getworkOrderItems()
{
workItemList = [select Service__c, Quantity__c, Length__c, Width__c from Work_Order_Item__c];
return workItemList;
}
public PageReference save() {
try {
upsert workOrder;
} catch(System.DMLException e) {
return null;
}
PageReference redirectpage = new ApexPages.StandardController(workOrder).view();
return (redirectpage);
}
public List<PieWedgeData> getPieData() {
List<PieWedgeData> data = new List<PieWedgeData>();
data.add(new PieWedgeData('Bedding', 30));
data.add(new PieWedgeData('Flooring', 15));
data.add(new PieWedgeData('Seating', 10));
data.add(new PieWedgeData('Wall Treatments ', 20));
data.add(new PieWedgeData('Other', 20));
return data;
}
// Wrapper class
public class PieWedgeData {
public String name { get; set; }
public Integer data { get; set; }
public PieWedgeData(String name, Integer data) {
this.name = name;
this.data = data;
}
}
}
<apex:page controller="WorkOrderController" tabstyle="Work_Order__c">
<apex:form >
<apex:pageBlock >
<apex:pageBlock title="Work Order Information" mode="edit">
<apex:pageBlockSection title="Work Order Details">
<apex:inputField value="{!workOrder.Account__c}" required="false"/>
<apex:inputField value="{!workOrder.Service_Date__c}" required="true"/>
<apex:inputField value="{!workOrder.Status__c}" required="true"/>
</apex:pageBlockSection>
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Save" action="{!save}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
<apex:pageBlock title="Summary">
<apex:page controller="WorkOrderController" title="Pie Chart">
<apex:chart height="350" width="450" data="{!pieData}">
<apex:pieSeries dataField="data" labelField="name"/>
<apex:legend position="right"/>
</apex:chart>
</apex:page>
</apex:pageBlock>
<apex:pageBlock >
<apex:pageBlockSection title="Products">
<apex:inlineEditSupport event="ondblClick"
showOnEdit="saveButton,cancelButton" hideOnEdit="editButton" />
<apex:pageBlockTable value="{!Products}" var="temp" >
<apex:column value="{!temp.Name}" />
<apex:column value="{!temp.Family__c}" />
<apex:column value="{!temp.Measurement_Type__c}" />
<apex:column value="{!temp.Cleaning_Unit_Price__c}" />
<apex:column value="{!temp.Treatment_Unit_Price__c}" />
</apex:pageBlockTable>
<apex:pageBlockTable value="{!workOrderItems}" var="temp" >
<apex:column value="{!temp.Service__c}" />
<apex:column value="{!temp.Quantity__c}" />
<apex:column value="{!temp.Length__c}" />
<apex:column value="{!temp.Width__c}" />
</apex:pageBlockTable>
<apex:inputField value="{!productFamily.Family__c}"/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:pageBlock>
</apex:form>
</apex:page>
Error is in expression '{!recordId}' in page test_2". Can you help me with this
1. Replace the below line like this in vf page
2. change the query like this in controller class
Glad to hear it works.
for pagination follow the below link .I found it very helpful.Hope it will help you too.Thanks !!
http://www.redpointcrm.com/add-pagination-to-your-visualforce-pages-using-the-soql-offset-clause
"Formula Expression is required on the action attributes." Can you help me with this?
try this .