Label make direct jobs with top level demand link?

Wondering if anyone has done the following or has thoughts about how might tackle it.

I need to mark/label all lower level make-direct jobs with the top level job number or demand link, to allow them to be grouped and can be reported on.

Here’s my thought process; create a BPM during the job creations, maybe when it’s released or engineered, that would look at the demand link to see if it’s linked to a order, if so, copy the Order number to a UD field(ForOrder) on the job. If it is a job demand link, copy the ForOrder UD field from the higher level demand job to the UD field.

Long as the jobs are created top down, I think this would work, and all connected lower level jobs would be tagged with the final order number. I would also like this to work during MRP too, as it creates unfirm jobs.

Thoughts? Ideas?