• SteveEthos
  • NEWBIE
  • 30 Points
  • Member since 2008

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 11
    Questions
  • 18
    Replies

Hello All,

 

 I need to fetch all fields of contact object and form a list box like as follows

 

 

  • First Name
  • Last Name
  • Email
  • Phone 
 
by choosing a item from listbox need to form SOQL query with choosen field name for e.g. If I choose 
 
Email field then my query will be 
 
 
data = [Select Phone,Name,email,Title from contact where  Email = NULL   ]  ;  
return data; 
 
I need to add "Email"  field as dynamic value. Here I am getting value of listbox item in controller method, but I am not able to concate string in SOQL. 
 
Can anyone help me? for following task
 
1. Create listbox with fetch fields from Contact object?
2. Create a dynamic field name value in SOQL?
 
 
Thanks 
 
Dowithforce

 

Message Edited by Dowithforce on 03-17-2009 03:09 AM

I have found a SOQL Statement that is slow with an OR condition, but fast if I take it out.

 

This always takes 3-4 seconds (returning 0 rows):

 

select count() from pat_Authorization__c where (r_episode_payer__r.r_subscriber__r.r_patient__c = 'a0999999999999' OR r_payer__r.r_patient__c = 'a0999999999999') AND  is_deleted__c = false 

 

(the a0999999999999 is a Salesforce ID)

 

 

This is fast: 

 

select count() from pat_Authorization__c where (r_episode_payer__r.r_subscriber__r.r_patient__c = 'a0999999999999') AND  is_deleted__c = false 

 

 

This is fast: 

 

select count() from pat_Authorization__c where (r_payer__r.r_patient__c = 'a0999999999999') AND  is_deleted__c = false 

 

 

Each of the "r_" fields are of type Lookup.

 

 

So, by testing each of the logical conditions separately, I have determined that one specifically is not the culprit.  So, why does adding the OR condition suddenly make it go slow?

 

 

I am also using the same WHERE clause on a SELECT id, name, .... FROM pat_Authorization__c where (r_episode_payer__r.r_subscriber__r.r_patient__c = 'a0999999999999' OR r_payer__r.r_patient__c = 'a0999999999999') AND  is_deleted__c = false 

 

 

So, I need to find a way to get the SOQL fast and to check both conditions and return the set.  If there was such a thing as UNION, then I could use that.

 

Thoughts?

Steve 

I have 2 objects:

 

Fee__c

    Has field key__c which is marked as an External ID.

 

FeeMarkup__c  (Points to fee)

    Has field key__c which is marked as an External ID. 

    Has field r_fee__c which is a lookup to Fee_c. 

 

 

I can use the DataLoader to load Fee__c fine.  The problem is when I try to load FeeMarkup__c.  I have the following data

 

 

FEE

key__c value__c

LP5 23

LP4 19

AG1 99 

 

 

FEEMARKUP

r_fee__c markup__c

LP5 1.1

LP4 1.0

 

 

When I use the data loader for FeeMarkup, I map r_fee__c to the lookup, and then the data loader asks me to confirm the external id field (key__c) on the Fee object.

 

However, I am getting the following error in the error results:

 

MALFORMED_ID:bad id LP5:-- 

 

 

This is an critical feature of my data loading, being able to upsert data with links to other objects, and refer to the other objects by their external Ids.

 

Has anyone else run into this problem, and have you been able to resolve it?

 

Thanks,

Steve 

 

 

 

We are trying to get the MassEmailMessage to work, but we have been unable.  By searching accross the Discussion Boards, we have found that others are having the same problem, but nobody has posted a solution.
 
Here is our sample code: 
 
List<Id> cIds = new List<Id>();

s_ContactDao cDao = new s_ContactDao();
Contact test = cDao.findLightById('0038000000feeT5');
cIds.add(test.Id);
test = cDao.findLightById('0038000000feeko');
cIds.add(test.Id);
    
Messaging.MassEmailMessage mail = new Messaging.MassEmailMessage();

//-- optional
mail.setSenderDisplayName('joe');
mail.setDescription('email descr');
mail.setSubject('test subject');
mail.setBccSender(false);
mail.setUseSignature(false);
mail.setWhatIds(cIds);

//-- req
mail.setTemplateId('00X80000001DffD');
mail.setTargetObjectIds(cIds);
debug('## getTargetObjectIds: ' + mail.getTargetObjectIds());
List<Messaging.Sendemailresult> resultList = Messaging.sendEmail(new Messaging.Massemailmessage[] { mail } , false);
debug('### result: ' + result);
 
 
Here is the results of the first debug:
"## getTargetObjectIds: (0038000000feeT5AAI, 0038000000feekoAAA)" 
 
 
Here is the result of the second debug: 
 
"result: (Messaging.SendEmailResult[getErrors=(Messaging.SendEmailError[getTargetObjectId=null;]);isSuccess=false;]) 
"
 
There is no valid error message given.  We have gone to the user screen and selected the following options:
 
Mass Email  (Checked)
Send Email   (Checked)
 
The documentation does not help.  Has anyone encountered and solved the same issue?
 
Thanks,
Steve 
 

We ran into a problem of needing to add a <META> tag to the <HEAD> of the brower in Salesforce.  You can add Javascrpt with the <apex:includeScript>, but there is current no documented way of adding other tags such as <META>

 

Here is a trick that I developed and appears to be working nicely:

 

I added a JavaScript file to the <HEAD> using <apex:includeScript value="{!$Resource.stevefix}"/>

 

The file: stevefix contains:

 

-------------

 function addToHEAD() 

{

  newScript = document.createElement('meta'),

  newScript .setAttribute('name', 'flag #1');

  newScript .setAttribute('content', 'true');

  

  var meta = document.getElementsByTagName('SCRIPT')[0];

  

  meta.parentNode.appendChild(newScript );

}

 

addToHEAD();

 

---------- 

 

This works by:

 

#1 The JS file is added in the head.

#2 Inside, it defines a function:  addToHEAD()

#3 It calls the function addToHEAD.

 

Inside the function, I use the DOM to find the first instance of <SCRIPT>.  This could actually be the JS itself, or another one from SF.

 

It creates a new tree node, populates it with the proper values.

 

Then it adds it to the parent of the found <SCRIPT>. (adds as a sibling of the found script).

 

Using this method, we may be able to add whatever we need to the <HEAD>.

 

Good luck and I hope that it helps.

 

Steve Simpson

Ethos - www.ethos.com 

When you build page layouts in SF, you can create a new Section, and one of the properties is "Tab-key Order", options are "Left-Right" or "Top-Down".

 

How can I create the same effect in Visual Force?

 

The pageBlockSection has the "columns" attrubute, but not the order direction.

 

Then I looked at the inputFields to see if I can change their index, but there is no easily exposed attribute. 

 

This seems like an oversight.  I figured that I could create similiar layouts/flow with VisualForce.

 

Am I missing someplace?

 

Thanks,

Steve 

I have a strange Catch-22 situation that I have nailed down, and I do not have a resolution.  I am trying to implement the library:  http://www.ejschart.com into SalesForce.

 

I have it working fine with FireFox and Chrome, but having troubles with IE.  

 

Here is a very simple page:

 

<apex:page > <apex:stylesheet value="{!$Resource.c_ejschart}/EJSChart/EJSChart.css"/> <apex:includeScript value="{!$Resource.c_ejschart}/EJSChart/EJSChart.js"/> <div id="chart6" style="width:400px; height:150px;" class="chart" ></div> <script type="text/javascript"> var ch6 = new EJSC.Chart( "chart6"); ch6.addSeries( new EJSC.BarSeries( new EJSC.ArrayDataHandler( [["1",10],["2",9],["3",10]]))); </script> 

</apex:page> 

 

As you can see, I have zipped up the /dist dir of EJS, and uploaded it as a resource.

 

This code works fine and looks good in FireFox and Chrome.  However, in IE, I am getting a 5 consecutive Javascript errors in SalesForce code:

 

window.sfdcPage = new GenericSfdcPage(); (Microsoft JScript runtime error: 'GenericSfdcPage' is undefined)

new AppPicker('https://www.salesforce.com/appexchange', '/S (Microsoft JScript runtime error: 'AppPicker' is undefined) 

(Microsoft JScript runtime error: 'MenuButton' is undefined)  

(Microsoft JScript runtime error: 'Sidebar' is undefined)   

 

Then SF displays with the Graph looking good. 

 

 

Evidentially something in the EJS library is causing a conflict with the SF Javascript.   I tried putting the <script> for the EJSChart.js in the body of the page, but then EJS does not function in IE, it must be in the <head>.

 

So, here is my quandry:  I have to have EJS in the <head>, but it breaks the SF Javascript.

 

Any thoughts, or any experiences with this?

 

Thanks,

Steve 

I have been digging through the Boards, but I have not found the solution to this problem:

 

 

I am building a model that has many different type of "People":  (Doctors, Nurses, Pharmacists, Technicians).

 

It makes the most sense to make them all Contacts with different record types (they have the common fields, but also record type specific fields).

 

I have custom objects that need links to specific Record Types.  For example, I have a Nursing visit object that needs a link to the Nurse.  

 

However, when I use the native lookup, it shows all Contact records (Doctors, Pharmacists, etc).   This is not acceptable.  

 

If I have a "Current Physician" field, I cannot allow them to put a Pharmacist in that field.

 

I have found no way to lock lookups down by record type.  

 

My only solution is to create custom objects.  However, this seems like such a waste of the Contact object and Record Types.

 

Any solutions?

Thanks,

Steve 

We are using the ANT migration tool to package up the different pieces of the application and move through our enviornments (DEV, STAGE, PROD).
 
I have been looking through the source files exported by the tool looking for where all of the settings reside.  I have not been able to find the following:
 
#1
SObject:  Standard Buttons and links:   Overrides to call Visual Force pages for these functional elements instead of the standard page layouts.
 
#2
Search Layouts:  The definition of the columns displayed for each of the Search Layout.
 
 
Without these, we cannot deploy the full functionality of our application turnkey.  I do not want to have to perform any manual tasks after a push.
 
Does anyone know where in the output files these settings reside?
 
Thanks,
Steve


Message Edited by SteveEthos on 08-14-2008 05:45 PM
Here is a problem that I have faced, and how I solved it. I am looking to see if there are other approaches:
 
I have to display a list of data.  I need to be able to customize the rows/cells of the display based on the data.  One example would be to display the text in Red if a certain condition is met.  Another would be to change the font/style/alignment based on the individual row data.
 
In a programming language like ASP .NET, I would be able to have the code behind (in Visual Force that would be the controller), be able to respond to certain events on the list object.  The one I use often in .NET is  "OnRowDataBound".  In that case the method is called for each row of data, and I get a handle to the visual objects that I can then customize.
 
In Visual Force, the Controller does not appear to have access to the VF Page.  It appears as though the relationship is one way, the VF page access attributes on the controller and calls methods for actions.
 
----------------------------------------------------------------------------
Here is a simple way to be able to accomplish it using the dataTable:
 
<apex:dataTable value="{!groups}" var="grp" >
             <apex:column styleClass="drugClassCol" >
                       <apex:facet name="header">Drug Class</apex:facet>
                        <span style="{!grp.nameStyle}">{!grp.obj.name}</span>
             </apex:column>    
</apex:dataTable>  

You can see that we created an html Span, and had the style returned from the row of data.  This way the data object can completely customize the style returned. 

----------------------------------------------------------------------------

However, you can see that there are 2 different attributes, and there is that "grp.obj.name".  The reason for this is that the SObject that we use does not and should not contain "Display code".  In the "Model View Controller" model, that means that the SObject is the Model, and the style generation is the View.  

We solve this problem by creating a SObject display object that contains the style customization logic. 

public class DrugGroupDisp
{
    private drug_group__c obj;
    public drug_group__c getObj()
    {
        return obj;
    }
    public void setObj(drug_group__c s)
    {
        obj = s;
    }

   public String getNameStyle()  

  {
        if (some condition} return 'color: red';

       return 'color: green';

    }

                   
    public void Setup(drug_group__c o)
    {
        obj = o;
    }
}

 

By having a direct reference to the original SObject, we can get access to all of its attributes, and then if needed we can made modifications and save.

the display object gives us a row level wrapper that can provide customizations that the Visual Force Page can use for rendering.

----------------------------------------------------------------------------

Here is how we load the display object:

public List<DrugGroupDisp> getGroups()
    {
         if (groups == null)
         {
             groups = new List<DrugGroupDisp>(); 
            
             for(drug_group__c groupRow : [select id, name, x1, x2, x3...   from drug_group__c])
            {
                DrugGroupDisp grp = new DrugGroupDisp();
                grp.Setup( groupRow );                                 
                groups.Add( grp);
            }     
        }   
        return groups;
    }

----------------------------------------------------------------------------

So, the controller loads the data into a list of Display objects, and the Visual Force page reads each row and access the getter methods on each row that can customize the display based on different value(s) on the SObject.

This is my solution to how to solve the problem.  Are there other approaches?  It would be great to know if there is another way! 

Hopefully sometime in the future we will have the ability for the Controllers to have more access into the rendering process for the VF Pages.

Thanks,

Steve



Message Edited by SteveEthos on 08-05-2008 12:08 PM
I have a Custom Button on my SObject, it is a List Button that points to a S-Control.  I have built a new Visual Force Page to replace it.  However, there is no option to select.
 
In the Page "Custom Button or Link Edit", the display type is a radio button with three options:
 
Detail Page Link
Detail Page Button
List Button
 
If you select List button, there is a Drop Down list for Content Source, the available options are:
 
URL
Custom S-Control
OnClick JavaScript.
 
 
There is no option for a Visual Force Page.  How can I utilize my VF page?
 
Thanks,
Steve
 
We have a VF page that uses multiple instances of a custom component, when we pass information in through the Component attributes, and try to get them to the Component Controller, they are not setting before a apex:dataTable reads from the controller.
 
Example:
 
----------------------------
Page has this code: (this segment is inside of a PageBlockSection)
 
<tr>
<td><c:MedComp cnId="{!cn__c.id}" medGrp="ACONV"/></td>
<td><c:MedComp cnId="{!cn__c.id}" medGrp="STIM"/></td>
</tr>
----------------------------
Component has this code:
 
<apex:component controller="MedCompController">
    <apex:attribute name="cnId" type="String" required="true" description="Cn ID" assignTo="{!cnID}"></apex:attribute>
    <apex:attribute name="medGrp" type="String" required="true" description="Med Group" assignTo="{!medGrp}"></apex:attribute>
    <apex:dataTable value="{!meds}" var="med">
        <apex:column >
            <apex:facet name="header">Trade Name</apex:facet>
            <span style="{!med.tradeStyle}">{!med.tradeName}</span>
        </apex:column>   
        <apex:column >
            <apex:facet name="header">Generic Name</apex:facet>
            <span style="{!med.genericStyle}">{!med.genericName}</span>
        </apex:column>   
        <apex:column >
            <apex:facet name="header">Sensitivity</apex:facet>
            <span style="{!med.sensitivityStyle}">{!med.sensitivity}</span>
        </apex:column>   
    </apex:dataTable>   
</apex:component>
 
----------------------------
Component Controller has this code:
 
public class MedCompController
{       
    List<MedSensitivity> meds;
       
    private String cnId;
    private String medGrp;
               
    public void setCnId(String s)
    {
        cnId = s;
    }  
    public String getCnId()
    {
        return cnId;
    }
       
    public void setMedGrp(String s)
    {
        medGrp = s;
    }
    public String getMedGrp()
    {
        return medGrp;
    }
               
    public List<MedSensitivity> getMeds()
    {  
        if (meds == null )
        {
            meds = new List<MedSensitivity>();
           
            for(med__c medRow : [select trade__c, generic__c, sensitivity__c, sub_group_name__c, sub_group_sensitivity__c
                from med__c
                where
                drug_class__c = :medGrp AND cn_id__c = :cnId])
            {
                MedSensitivity medItem = new MedSensitivity();
                medItem.Setup( medRow);                                
                meds.Add( medItem);
            }      
        }
       
        return meds;
    }  
}
 
---------------------------------------------------------------
The CnID and Med groups are passed into the Component through the Attributes at the top of the component.  We have set the {assignTo} attributes, so they should call the Setter methods on the Controller, and the values should be stored on the Component.
 
The problem is that it appears as though the apex:dataTable is accessing the {meds} attribute on the Controller prior to the setter values from the attributes being set.  
 
How can we pass data into the Component Controller from the calling page, and have it availble for the building of the Data table?   There appears to be no way for this to work.
 
All the examples for the SQL in the Controller show using the Current Page parameters.  However, we will have mutliple instances of the Components on a page, and need to send different values to each one.
 
This appears to be a bug in Visual Force.
 
Thanks,
Steve

I have 2 objects:

 

Fee__c

    Has field key__c which is marked as an External ID.

 

FeeMarkup__c  (Points to fee)

    Has field key__c which is marked as an External ID. 

    Has field r_fee__c which is a lookup to Fee_c. 

 

 

I can use the DataLoader to load Fee__c fine.  The problem is when I try to load FeeMarkup__c.  I have the following data

 

 

FEE

key__c value__c

LP5 23

LP4 19

AG1 99 

 

 

FEEMARKUP

r_fee__c markup__c

LP5 1.1

LP4 1.0

 

 

When I use the data loader for FeeMarkup, I map r_fee__c to the lookup, and then the data loader asks me to confirm the external id field (key__c) on the Fee object.

 

However, I am getting the following error in the error results:

 

MALFORMED_ID:bad id LP5:-- 

 

 

This is an critical feature of my data loading, being able to upsert data with links to other objects, and refer to the other objects by their external Ids.

 

Has anyone else run into this problem, and have you been able to resolve it?

 

Thanks,

Steve 

 

 

 

When you build page layouts in SF, you can create a new Section, and one of the properties is "Tab-key Order", options are "Left-Right" or "Top-Down".

 

How can I create the same effect in Visual Force?

 

The pageBlockSection has the "columns" attrubute, but not the order direction.

 

Then I looked at the inputFields to see if I can change their index, but there is no easily exposed attribute. 

 

This seems like an oversight.  I figured that I could create similiar layouts/flow with VisualForce.

 

Am I missing someplace?

 

Thanks,

Steve 

I have a strange Catch-22 situation that I have nailed down, and I do not have a resolution.  I am trying to implement the library:  http://www.ejschart.com into SalesForce.

 

I have it working fine with FireFox and Chrome, but having troubles with IE.  

 

Here is a very simple page:

 

<apex:page > <apex:stylesheet value="{!$Resource.c_ejschart}/EJSChart/EJSChart.css"/> <apex:includeScript value="{!$Resource.c_ejschart}/EJSChart/EJSChart.js"/> <div id="chart6" style="width:400px; height:150px;" class="chart" ></div> <script type="text/javascript"> var ch6 = new EJSC.Chart( "chart6"); ch6.addSeries( new EJSC.BarSeries( new EJSC.ArrayDataHandler( [["1",10],["2",9],["3",10]]))); </script> 

</apex:page> 

 

As you can see, I have zipped up the /dist dir of EJS, and uploaded it as a resource.

 

This code works fine and looks good in FireFox and Chrome.  However, in IE, I am getting a 5 consecutive Javascript errors in SalesForce code:

 

window.sfdcPage = new GenericSfdcPage(); (Microsoft JScript runtime error: 'GenericSfdcPage' is undefined)

new AppPicker('https://www.salesforce.com/appexchange', '/S (Microsoft JScript runtime error: 'AppPicker' is undefined) 

(Microsoft JScript runtime error: 'MenuButton' is undefined)  

(Microsoft JScript runtime error: 'Sidebar' is undefined)   

 

Then SF displays with the Graph looking good. 

 

 

Evidentially something in the EJS library is causing a conflict with the SF Javascript.   I tried putting the <script> for the EJSChart.js in the body of the page, but then EJS does not function in IE, it must be in the <head>.

 

So, here is my quandry:  I have to have EJS in the <head>, but it breaks the SF Javascript.

 

Any thoughts, or any experiences with this?

 

Thanks,

Steve 

I have been digging through the Boards, but I have not found the solution to this problem:

 

 

I am building a model that has many different type of "People":  (Doctors, Nurses, Pharmacists, Technicians).

 

It makes the most sense to make them all Contacts with different record types (they have the common fields, but also record type specific fields).

 

I have custom objects that need links to specific Record Types.  For example, I have a Nursing visit object that needs a link to the Nurse.  

 

However, when I use the native lookup, it shows all Contact records (Doctors, Pharmacists, etc).   This is not acceptable.  

 

If I have a "Current Physician" field, I cannot allow them to put a Pharmacist in that field.

 

I have found no way to lock lookups down by record type.  

 

My only solution is to create custom objects.  However, this seems like such a waste of the Contact object and Record Types.

 

Any solutions?

Thanks,

Steve 

Hello All,

 

 I need to fetch all fields of contact object and form a list box like as follows

 

 

  • First Name
  • Last Name
  • Email
  • Phone 
 
by choosing a item from listbox need to form SOQL query with choosen field name for e.g. If I choose 
 
Email field then my query will be 
 
 
data = [Select Phone,Name,email,Title from contact where  Email = NULL   ]  ;  
return data; 
 
I need to add "Email"  field as dynamic value. Here I am getting value of listbox item in controller method, but I am not able to concate string in SOQL. 
 
Can anyone help me? for following task
 
1. Create listbox with fetch fields from Contact object?
2. Create a dynamic field name value in SOQL?
 
 
Thanks 
 
Dowithforce

 

Message Edited by Dowithforce on 03-17-2009 03:09 AM
Hey,

Anybody come across this problem before?  Here's some code to send out a single e-mail:

Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage ();
mail.setToAddresses ( new String[] { 'xxx.yyy.zzz' } );
mail.setSubject ( 'TEST' );
mail.setPlainTextBody ( 'TEST' );

Messaging.sendEmailResult[] results = Messaging.sendEmail ( 
                                           new Messaging.SingleEmailMessage[] { mail } , False
                                      );
for ( Messaging.sendEmailResult result : results ) {
    if ( !result.isSuccess () ) {
        System.debug ( result );
} }

Note the deliberately bogus e-mail address.  When you run this, the following text is debug'ed out:

Messaging.SendEmailResult[
  getErrors=(
    Messaging.SendEmailError[
      getFields=null;
      getMessage=Invalid to address xx.yyy.zzz;
      getStatusCode=System.StatusCode.INVALID_EMAIL_ADDRESS;
      getTargetObjectId=null;
    ]
  );
  isSuccess=false;
]

 
Note that the getErrors() "member" is a Messaging.SendEmailError[] array, as specified in the Apex Ref Guide.

Now change the loop to

for ( Messaging.sendEmailResult result : results ) {
if ( !result.isSuccess () ) {
Messaging.sendEmailError[] errs = result.getErrors ();
}
}

Seems reasonable, based on the first code fragment - but in fact it doesn't even compile:
Illegal assignment from LIST:Database.Error to LIST:Messaging.SendEmailError

So - change the loop as follows:

Code:
for ( Messaging.sendEmailResult result : results ) {
if ( !result.isSuccess () ) {
Database.error[] errs = result.getErrors ();
}
}

and it compiles, but now throws a run-time error, to the effect that you can't cast a Messaging.SendEmailError object to a
Database.error. Seems like some sort of internal inconsistency.

OK - now here's the real WTF about this: Everything I've written here was demonstrably true until 30 min ago - but as of now -
 the last loop does not throw that run-time error any more! I would just discard this msg, but it took me a certain amount of effort
and now I'd like to share my worry about the behaviour of production orgs (yes, I was testing both in Sandbox and in Prod
throughout) changing in the middle of a working day.

Thoughts/insight anyone?
 
  • November 17, 2008
  • Like
  • 0
Hello,

I am having issue with DatePicker not popping up automatically. In fact, it does not pop up at all. My input field is definitely a date field. Firebug reports problem like this :-

Error:
this.div is null
https://na3.salesforce.com/dJS/en/1219782666000/library.js
Line 22568

this.div is null
iframeShim(null)library.js (line 22568)
DatePicker()library.js (line 7537)
pickDate()(true, "j_id0:j_id1:j_id134:j_id135:j_id215:j_id216:j_id220:0:j_id224", false, undefined)library.js (line 7795)
onfocus(focus )IPPage—i...FLg%3D%3D (line 2)
[Break on this error] if (this.div.currentStyle) {

 Could anyone help me?

Thanks

We are using the ANT migration tool to package up the different pieces of the application and move through our enviornments (DEV, STAGE, PROD).
 
I have been looking through the source files exported by the tool looking for where all of the settings reside.  I have not been able to find the following:
 
#1
SObject:  Standard Buttons and links:   Overrides to call Visual Force pages for these functional elements instead of the standard page layouts.
 
#2
Search Layouts:  The definition of the columns displayed for each of the Search Layout.
 
 
Without these, we cannot deploy the full functionality of our application turnkey.  I do not want to have to perform any manual tasks after a push.
 
Does anyone know where in the output files these settings reside?
 
Thanks,
Steve


Message Edited by SteveEthos on 08-14-2008 05:45 PM
Here is a problem that I have faced, and how I solved it. I am looking to see if there are other approaches:
 
I have to display a list of data.  I need to be able to customize the rows/cells of the display based on the data.  One example would be to display the text in Red if a certain condition is met.  Another would be to change the font/style/alignment based on the individual row data.
 
In a programming language like ASP .NET, I would be able to have the code behind (in Visual Force that would be the controller), be able to respond to certain events on the list object.  The one I use often in .NET is  "OnRowDataBound".  In that case the method is called for each row of data, and I get a handle to the visual objects that I can then customize.
 
In Visual Force, the Controller does not appear to have access to the VF Page.  It appears as though the relationship is one way, the VF page access attributes on the controller and calls methods for actions.
 
----------------------------------------------------------------------------
Here is a simple way to be able to accomplish it using the dataTable:
 
<apex:dataTable value="{!groups}" var="grp" >
             <apex:column styleClass="drugClassCol" >
                       <apex:facet name="header">Drug Class</apex:facet>
                        <span style="{!grp.nameStyle}">{!grp.obj.name}</span>
             </apex:column>    
</apex:dataTable>  

You can see that we created an html Span, and had the style returned from the row of data.  This way the data object can completely customize the style returned. 

----------------------------------------------------------------------------

However, you can see that there are 2 different attributes, and there is that "grp.obj.name".  The reason for this is that the SObject that we use does not and should not contain "Display code".  In the "Model View Controller" model, that means that the SObject is the Model, and the style generation is the View.  

We solve this problem by creating a SObject display object that contains the style customization logic. 

public class DrugGroupDisp
{
    private drug_group__c obj;
    public drug_group__c getObj()
    {
        return obj;
    }
    public void setObj(drug_group__c s)
    {
        obj = s;
    }

   public String getNameStyle()  

  {
        if (some condition} return 'color: red';

       return 'color: green';

    }

                   
    public void Setup(drug_group__c o)
    {
        obj = o;
    }
}

 

By having a direct reference to the original SObject, we can get access to all of its attributes, and then if needed we can made modifications and save.

the display object gives us a row level wrapper that can provide customizations that the Visual Force Page can use for rendering.

----------------------------------------------------------------------------

Here is how we load the display object:

public List<DrugGroupDisp> getGroups()
    {
         if (groups == null)
         {
             groups = new List<DrugGroupDisp>(); 
            
             for(drug_group__c groupRow : [select id, name, x1, x2, x3...   from drug_group__c])
            {
                DrugGroupDisp grp = new DrugGroupDisp();
                grp.Setup( groupRow );                                 
                groups.Add( grp);
            }     
        }   
        return groups;
    }

----------------------------------------------------------------------------

So, the controller loads the data into a list of Display objects, and the Visual Force page reads each row and access the getter methods on each row that can customize the display based on different value(s) on the SObject.

This is my solution to how to solve the problem.  Are there other approaches?  It would be great to know if there is another way! 

Hopefully sometime in the future we will have the ability for the Controllers to have more access into the rendering process for the VF Pages.

Thanks,

Steve



Message Edited by SteveEthos on 08-05-2008 12:08 PM
I have a Custom Button on my SObject, it is a List Button that points to a S-Control.  I have built a new Visual Force Page to replace it.  However, there is no option to select.
 
In the Page "Custom Button or Link Edit", the display type is a radio button with three options:
 
Detail Page Link
Detail Page Button
List Button
 
If you select List button, there is a Drop Down list for Content Source, the available options are:
 
URL
Custom S-Control
OnClick JavaScript.
 
 
There is no option for a Visual Force Page.  How can I utilize my VF page?
 
Thanks,
Steve
 
We have a VF page that uses multiple instances of a custom component, when we pass information in through the Component attributes, and try to get them to the Component Controller, they are not setting before a apex:dataTable reads from the controller.
 
Example:
 
----------------------------
Page has this code: (this segment is inside of a PageBlockSection)
 
<tr>
<td><c:MedComp cnId="{!cn__c.id}" medGrp="ACONV"/></td>
<td><c:MedComp cnId="{!cn__c.id}" medGrp="STIM"/></td>
</tr>
----------------------------
Component has this code:
 
<apex:component controller="MedCompController">
    <apex:attribute name="cnId" type="String" required="true" description="Cn ID" assignTo="{!cnID}"></apex:attribute>
    <apex:attribute name="medGrp" type="String" required="true" description="Med Group" assignTo="{!medGrp}"></apex:attribute>
    <apex:dataTable value="{!meds}" var="med">
        <apex:column >
            <apex:facet name="header">Trade Name</apex:facet>
            <span style="{!med.tradeStyle}">{!med.tradeName}</span>
        </apex:column>   
        <apex:column >
            <apex:facet name="header">Generic Name</apex:facet>
            <span style="{!med.genericStyle}">{!med.genericName}</span>
        </apex:column>   
        <apex:column >
            <apex:facet name="header">Sensitivity</apex:facet>
            <span style="{!med.sensitivityStyle}">{!med.sensitivity}</span>
        </apex:column>   
    </apex:dataTable>   
</apex:component>
 
----------------------------
Component Controller has this code:
 
public class MedCompController
{       
    List<MedSensitivity> meds;
       
    private String cnId;
    private String medGrp;
               
    public void setCnId(String s)
    {
        cnId = s;
    }  
    public String getCnId()
    {
        return cnId;
    }
       
    public void setMedGrp(String s)
    {
        medGrp = s;
    }
    public String getMedGrp()
    {
        return medGrp;
    }
               
    public List<MedSensitivity> getMeds()
    {  
        if (meds == null )
        {
            meds = new List<MedSensitivity>();
           
            for(med__c medRow : [select trade__c, generic__c, sensitivity__c, sub_group_name__c, sub_group_sensitivity__c
                from med__c
                where
                drug_class__c = :medGrp AND cn_id__c = :cnId])
            {
                MedSensitivity medItem = new MedSensitivity();
                medItem.Setup( medRow);                                
                meds.Add( medItem);
            }      
        }
       
        return meds;
    }  
}
 
---------------------------------------------------------------
The CnID and Med groups are passed into the Component through the Attributes at the top of the component.  We have set the {assignTo} attributes, so they should call the Setter methods on the Controller, and the values should be stored on the Component.
 
The problem is that it appears as though the apex:dataTable is accessing the {meds} attribute on the Controller prior to the setter values from the attributes being set.  
 
How can we pass data into the Component Controller from the calling page, and have it availble for the building of the Data table?   There appears to be no way for this to work.
 
All the examples for the SQL in the Controller show using the Current Page parameters.  However, we will have mutliple instances of the Components on a page, and need to send different values to each one.
 
This appears to be a bug in Visual Force.
 
Thanks,
Steve