Forum Discussion

swatiaa's avatar
swatiaa
New Contributor
11 months ago

Do we have any method to get Fields name return by SOQL Query ?

 Actually I have script code where my SOQL Query is returning ID, But instead of ID if we have get any other field value then i have to write another method.

Current implementation:

    account = Salesforce.Query(soql)
    getSfdcRowId.id = account.GetItem(0).Id

 

Is there any way where instead of giving specific field name we can give field position ?

Or we can give give dynamic Field value in this expression account.GetItem(0).Id

 

so that i can use only one method for fetching any data ?

1 Reply

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    I'm assuming you are using ODBC driver to connect to SOQL? If yes, then you need to refer to the documentation for that specific ODBC driver to see if it supports what you require.

     

    Using the "field position" is not a good way of retrieving data, because it means you need to know the underlying structure of the tables and field columns. If a new column is added, then you'll have to update your code.