The customer needs to synchronize the SAMAccountName from the source to the target. For some users, the source SAMAccountName is in the format “TW_BA_BC”. In these cases, the “TW_” prefix should be removed so that the target SAMAccountName is “BA_BC”.
For certain users, the source sAMAccountName includes the prefix “TW_” (for example, “TW_BA_BC”). This prefix should be trimmed so that the target SAMAccountName is “BA_BC”.
The Formula as follow:-
SUBSTRING(SAMAccountName,LEN(LEFT(SAMAccountName,CHARINDEX('_', SAMAccountName)+1)),LEN(SAMAccountName) - LEN(LEFT(SAMAccountName,CHARINDEX('_', SAMAccountName))))