Hi Glen...
I believe there is no simple way to do it - as AX will continuously drops an index during synchronization. The only way that comes on top of my mind is to overwrite Application.dbSynchronize method and recreate an index after synchronization is completed. So using Sukrut code your solution would look like that:
public boolean dbSynchronize(
TableId tableId = 0, // 0 = all tables, non-zero is a valid table handle
boolean syncAsNeeded = true, // true = objects touched in the AOT, false = unconditional synchronize
boolean continueOnError = true,
boolean showProgress = true, // true = report all problems, but throw only after all tables are synchronized, false = stop synchronize after first error/problem
container checkSyncTables = conNull(), // [0] all tables or [x, y, z, ...] for 1 or more tables
boolean createAllIndexes = true,
boolean useLockForSingleTable = true)
{
....
// Your code start here -->
str sql;
Connection conn;
SqlStatementExecutePermission permission;
// Your code ends here <--
....
....
ok = super(tableId, syncAsNeeded, continueOnError, showProgress, checkSyncTables, createAllIndexes, useLockForSingleTable);
// Your code starts here -->
if (ok && (tableId == tableNum(AccessRightsList) || tableId == 0))
{
// Create index statement
sql = "";
permission = new SqlStatementExecutePermission(sql);
permission.assert();
conn = new Connection();
// the permissions needs to be reverted back to original condition.
Statement statement = conn.createStatement();
statement.executeUpdate(sql);
statement.close();
CodeAccessPermission::revertAssert();
}
// Your code ends here <--
....
....
}