RootsMagic 4-7 (current) list the user-added roles in the Edit Fact Type dialog in the order that they were created, after the builtin roles such as Principal and Witness. For fact types to which many roles have been added, it is desirable that they be sorted alphabetically. While this should easily be done within the program for display purposes and has been requested repeatedly over years, until such an enhancement is provided here is a script that uses a brute force method to rearrange the rows in the data table so that the role names are presented alphabetically.
RoleSortBeforeAfter.png
As far as I can tell, the script is harmless. There is no need to use RootsMagic's Rebuild Indexes after its execution but it would be advisable to test it on a copy of your database or make a backup before applying it. It was developed using SQLiteSpy but uses no esoteric functions so it should run with any SQLite manager that supports a fake RMNOCASE collation extension..

Caveat: If a future version of RM increases the number of builtin roles to more than 58, every instance of 58 in the script must be revised accordingly else those builtin roles above the RoleID of 58 will be mixed up with a user-added role after a drag'n'drop or GEDCOM transfer to another RootsMagic database..

Tip: If you want the role names to appear in an order sorted by your preference, rename them prefixed by a number, e.g.:
  1. with Parents
  2. with Father
  3. with Grandparents
  4. Other
If you have more than 9 roles, then use double digits:
01 with Parents
02 with Father
...