I'm forcing every batch to go through verification, I need to get the username of the person that opened the batch. I need to get the username even if the document wasn't opened or any rules run.
At the moment I have code on event handler 'after document rule checked':
string verifiedField = "Invoice Layout\\VerifiedBy";
string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
userName = Regex.Replace(userName,".*\\\\(.*)", "$1", RegexOptions.None);
if (userName != "fcservices" && userName != "Administrator")
Document.Field( verifiedField ).Text = userName;
Which works fine but the event handler doesn't always fire if the document has no verification or errors.
Same as if using standard rule script, it doesn't always run.
Would be nice to have a batch opened event handler that could update document definition fields.
Have also tried batch event handlers but they can't modified document fields or batch parameters.
Have also tried service field 'last editor info' but that will populate the service account running the processing station if no changes have been made to document.
Any help appreciated.