Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SObject.describe_field method #84

Open
rferg opened this issue Jan 17, 2024 · 1 comment
Open

SObject.describe_field method #84

rferg opened this issue Jan 17, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@rferg
Copy link
Contributor

rferg commented Jan 17, 2024

SObject.describe is a nice convenience method when I want to investigate the SF metadata behind an object.

However, I'm often only looking for a particular field and the object that's returned from this endpoint is rather large and unruly. For example, to get the metadata for a particular field, I run something like this:

MyObject.describe.fields.find { |f| f['name'] == 'My_Field__c' }

Which is kind of verbose and requires having to look up the name of the SF field that maps to the object attribute.

It would be nice if ActiveForce exposed a method that did this for me, including mapping a symbol for the attribute name to the correct SF field name. Something like:

MyObject.describe_field(:my_field)

It should also take a string for the actual SF field as well, which should be pretty easy to implement.

MyObject.describe_field('My_Field__c')

Or, possibly it should be variadic and take one or many field names, returning an array of field metadata:

MyObject.describe_fields(:my_field, :another_field, 'One_More__c')
@rferg rferg added the enhancement New feature or request label Jan 17, 2024
@rferg
Copy link
Contributor Author

rferg commented Jan 17, 2024

I'm happy to write up a PR for this--should be straightforward. But wanted to open for discussion before moving forward. Would anyone else actually use this or is this just a very niche nice-to-have? What should the API be if it is actually useful?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant