0

I am making a Gantt chart in SalesForce using Dhtmlx. I have created the chart. The object for the chart in SalesForce is Project__c.

Whenever I want to make a select field in the lightbox in Gantt, I create a picklist in Project__c and map it to the field.

I want to add a field for the owner name in the lightbox using select/picklist. The owner is any user in the User object. I have created a field in Project__c called project_owner__c that is a lookup to User.

From what I understand, I have the following options:

  1. Convert lookup field in SalesForce to a picklist field in SalesForce and proceed using the steps for other picklist fields.
  2. Create an apex code that extracts all the values in the lookup dynamically.
  3. Make a JS file that extracts all the values in the lookup field and send the list/array to the apex class and map it to visual force.

I have been trying all three, but have not succeeded. What is the best way to proceed? Are any of the options I have been trying viable?

1 Answer 1

0

The Apex option is certainly viable. It shouldn't be too complicated to generate a List<SelectOption>.

Extension

public with sharing class MyExtension
{
    public List<SelectOption> users { get; private set; }
    public MyExtension(ApexPages.StandardController controller)
    {
        users = new List<SelectOption>();
        for (User record : [SELECT Name FROM User])
            users.add(new SelectOption(record.Id, record.Name));
    }
}

Markup

<apex:page standardController="Project__c" extensions="MyExtension">
    <apex:form>
        <apex:selectList value="{!Project__c.Project_Owner__c}">
            <apex:selectOptions value="{!users}" />
        </apex:selectList>
    </apex:form>
</apex:page>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .