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
JimmmyJimmmy 

Dynamically Querry Merge fields?

Is there a way to Dynamically Query Merge fields that would include all custom merge fields that were set up? this would be for use in an S-Control.

werewolfwerewolf
I guess you could probably cobble that together using the results of a describeSObject call.  What are you trying to accomplish?
JimmmyJimmmy
We have some custom merge fields ie.. {!Lead.HatSize_C}.  And if we add or change them the SControl Loads what ever is avalible.
werewolfwerewolf
But loads in what way?

You can't make your Scontrols use random merge fields that will resolve at runtime but that you didn't necessarily know about at compile time.  If you want to do something like that you're better off doing a describe call and then generating a query that gets those values.
JimmmyJimmmy
the S-Contol is on the Lead tab and I want all Fields for the Lead and their values.
werewolfwerewolf
I understand that, but what do you intend to do with the field names and values?  You can't just throw a bunch of merge fields into an Scontrol and expect it to know what to do with them.

If you are doing something data-driven that is dependent on loading all the field names and values, then as I mentioned, you're likely better off doing a query using the AJAX toolkit after your Scontrol loads than trying to do it with merge fields.
JimmmyJimmmy
I am planing to load them into a select list... I am trying to use DescribeSObjects and I can get the merge field name but not the value, now I think I have to do an SOQL query to return the value.
werewolfwerewolf
Right, you have to do a describe and then generate a select or retrieve query with those fields to actually get the values.