- We've requirement to 'PERIODICALLY' fetch description of all object and their custom fields and store in NEW custom object(FieldsAndObjectDescription)
- We've huge Org and have more than 20K custom fields and around 1000 Custom objects.
- Any time any field/object description is changed or new field added in future, details should be updated in New object(FieldsAndObjectDescription) (synchronous or asynchronous, whatever is easy)
- I'm thinking to use Tooling API for this(Tried and it is working fine).
Problem : How to write a job which can be scheduled periodically to do this.
Since, 20K records needs to be created(and potentially updated) ,I was thinking to write a batch job but Stuck how to start?
- Could I run Rest(Tooling) API in Start method? I'm not sure, if that is even possible . But If that is , what should be passed to 'Database.queryLocator?
- If not in 'Start' method, Do I need to do call tooling API from 'Execute' method, then what should be in 'Start' Method. This, if possible, seems to be somehow preferable as I know I shouldn't cause Tooling API to return 20K record in single request(which might crash, although not tested). I prefer to make multiple requests.
- If Batch job itself is right way to work with tooling API, what is the best way to handle Tooling API response, which might be in thousands ?