Order of operations is:
1. Variables/Events are populated from the form fields in the Tool config > Global Variables (if s.tl call, DTM does not register to linkTrackVars and linkTrackEvents at this point)
2. Variables/Events are populated from the form fields in the Rule (if s.tl call, DTM does not register to linkTrackVars and linkTrackEvents at this point)
3. Custom Code box code in the Rule is evaluated (if s.tl call, make sure to register your variables/events set within your custom code box to linkTrackVars and linkTrackEvents)
4. Variables/Events populated from the form fields (for both Global and Rule vars) are registered (appended) to linkTrackVars and linkTrackEvents