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
hassabhassab 

how to displaying roles and view or hyperlinks on a visualforce related list?

Hello all,

 

I have a custom related list build on VF extending a standard controller.  All seems to be working well but I have 2 things I'd like to add:

 

1 - how does one go about implementing a case statement or an if-then-else statement to display the role a person might have with the object.  For example, my related list pulls all the contracts a person might be related to.  However that person could be the signee, the company contact, the company signed by or the person assigned to a handful of custom lookup fields associated with the contract.  Under normal circumstances I would build a case statement in the SQL query to pull the role the person has with the record, but SOQL doesn't seem to like that.  Doesn't seem to like an if statement either.  Does anyone have any ideas?  Here's my controller:

 

public with sharing class constituentDetailsController {

    private List<Contract> contracts;

    private Contact cntact;

    public constituentDetailsController (ApexPages.StandardController controller) {

        this.cntact= (Contact)controller.getRecord();

    }

    public List<Contract> getContracts()

    {

        Contact con = [Select id FROM Contact where id = :cntact.id];

        if (con.id == null)

         return null;

          contracts = [Select id, Name, Status, Amount__c, Contract_Date__c

                                    from Contract

                                    where CompanySignedID = :con.id

                                                or OwnerID = :con.id

                                                or CustomerSignedID = :con.id

                                                or Artist__c = :con.id

                                                or Consultant__c = :con.id

                                                or Signee__c = :con.id

                                                or JALC_Signee__c = :con.id

                                                or Organization_Contact__c = :con.id

 

            ];

        return contracts;

    }

 

2.  I have added an edit link to the related list so that a person can get to the edit page of the contract record.  How can I either hyperlink or add a "view" link to the list so that they can just get to the details page?

 

Thanks in advance!

 

-Hassab