Running the xRef update from the menu to execute within the AX client is taking a very long time, 10-12 hours easily. If you kick it off in a batch job by running an X++ job, it could finish in 2-3 hours server-side instead. That is the purpose of the above code, rebuilding cross-references faster.
Please mark helpful answers as Verified next to each post with the checkbox.