from salesforce_api import Salesforce
client = * connection details*
desc_obj = client.sobjects.Case_Details__c.describe()
I want to the object name to be dynamic as it will be an user input. Something like:-
from salesforce_api import Salesforce
client = * connection details*
def extract_sffields(table_name):
desc_obj = client.sobjects.%table_name%.describe()
where table is dynamic.
In Python you can use the builtins getattr
and setattr
to manipulate object attributes. So you can write:
desc_obj = getattr(client.sobjects, table_name).describe()