0 votes
1 view
in Salesforce by (11.9k points)

I'm trying to build a query builder, where the sObject result can contain an indeterminate number of fields. I'm using the result to build a dynamic table, but I can't figure out a way to read the sObject for a list of fields that were in the query.

I know how to get a list of ALL fields using the getDescribe information, but the query might not contain all of those fields.

Is there a way to do this?

1 Answer

0 votes
by (30.1k points)

Looks like you're building the query up as a string since it's dynamic, so couldn't you just loop through the fields in the description information, and then use .contains() on the query string to see if it was requested? Not crazy elegant, but seems like the simplest solution here.

Taking this further, maybe you have the list of fields selected in a list of strings or similar, and you could just use that list?

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...