I have a problem statement where I need to store a list of some 40 Parent Objects Ids statically. Further, if any one of the Parent Object's child records goes higher then 45,000(which is calculated using the roll-up summary field on parent object) I need to replace that parent objects Id from this list with new object's Id. Earlier this could have been done by maintaining the same in custom setting record's field, as same is updateable through apex code. But as custom settings being depreciated, it is becoming challenging to do so. Following alternatives I have found but couldn't proceed with:
- Using Custom metadata type object record.As we can update the same through metadata API and deployments. But this requires metadata modify permission, which I cannot afford to give to my user.
- Thought of static resource, but DML cannot be performed on it.
- Custom labels, but cannot be updated.
If anybody has an alternative for this please share the same.
Business Scenario: For the creation of child object A we need parent object as a must. In some scenarios the parent object is present but on some, it is not. So they have created a list of dummy parent object which they maintain in the custom label and using round robin or random number logic they assign the parent object to child objects. But a huge number of child records are getting created, they are now getting 50,001 exceptions while querying the parent object. So they replace the parent Id from a label with new parent object's one, manually as soon as it reaches 48,000 or something to prevent the same 50,001 exceptions. But they have to do this manually. I need to automate the same.(Weird scenario)
When a child object A is created,an integration user(with whom the records are shared) performs some calculations based on values on A , and attach 3 more objects to it with some values(financial calculations).But for these caculations to be done and these new objects to be created , A must hold the parent object to it as mandatory.And this parent object is the dummy objects they have created.