To answer directly, you can't link Apex triggers and workflows in the way you're discussing, but you can configure declarative automation and Apex to pull from the same store of configuration values - Custom Settings. By creating a Custom Setting with a field to store the number of days you want to use, you can have both declarative and programmatic solutions adapt when you change that configuration.
In a Workflow Rule, you can easily reference Custom Settings values by choosing "Run this rule if the -> formula evaluates to true" and clicking Insert Field. Your hierarchy custom settings are listed in the field tree for selection.
Additionally, note that Scheduled Apex and triggers are separate functionality. What you're describing is closer to a scheduled Batch Apex job.
However, you don't need to go to that extremity to achieve what you're seeking here. Your objective looks like it's achievable with plain old Time-Dependent Workflow Actions.
You'd set up a criterion for old_case__c
being false, and establish a time-dependent action for 50 days after creation date, with a field update to set old_case__c
to true.
Time-based actions are a little counterintuitive, so I recommend reading through the doc linked above thoroughly to figure out how they handle changes to dates and criteria fields (it generally just does the right thing for you), but this should get you set with no Apex at all.
While it's true that this won't solve the issue of your existing Cases, you can work around this. Create a new field (say Case_Cleanup__c
, a Checkbox) on your Case. Then add a new Workflow Rule with the entry criterion of Case_Cleanup__c = true
, and use the same Time-Dependent Action you use for your primary workflow (50 days after Creation Date, update old_case__c
). Finally, just use a Data Loader job to set the Case_Cleanup__c
field on all your old Cases that need to be handled, and you'll get the proper timed actions scheduled via that new workflow. Once they're all processed in ~2 months, you can remove the new field and the extra workflow.