So working on better logs and alternate login options.
Seen it asked a couple of times but not seen a documented solution.
I plan to use this to log and set state value for void and the likes.
I like having void available for all rolls as this allows a passing manager to void mistakes without having to switch to their user.
This however will show as a void for the current user not the manager than ‘swiped’ to confirm admin pin.
So rather than use confirm admin pin I have used a script and a multi set command flow with [?prompt] for pin entry then script to check can confirm admin pin option for the user with the ‘swipped’ pin.
Since I would prefer to use less rules for easier managment I will pass all the automation command through my own can confirm admin pin rule before triggering the actual command for say void.
My example is for Void but will extend this to refund and gift etc.
Fisrt step is to change the VOID automation command button.
Rather than going straight to the void command rule it will now go to my new processing rule;
You will see I have added - ConfirmAdminPin to the command name and set Void as the only value in the values field. I will use this command value to separate the end command back to the original void rule once pin is and can confirm roll checked.
Next I make a ‘Custom Confirm Admin Pin’ rule;
So the automation command name is constrained to the ‘Void - ConfirmAdminPin’ command now triggered by the Void button.
I then use an execute automation command action to trigger the original void rule.
Using [:CommandValue] passed from the button the triggered rule after this will now be the origional Void rule.
Now for the command value I use a {CALL:xx} function with a [?Prompt]. The prompt will ask for user to enter a pin like confirm admin pin. The entered value is passed to the acript to validate and will pass the value returned as the command value into the void rule.
I have used this script;
function canConfirmAdminPin(inputPin){
qry = "SELECT u.Name as UserName ,max(case when p.[Name] = 'CanConfirmAdminPin' then p.value end) as CanConfirmAdminPin ";
qry += "FROM [Users] u JOIN [UserRoles] r on r.Id = u.UserRole_Id JOIN [Permissions] p on r.id = p.UserRoleId ";
qry += "WHERE u.PinCode = '"+inputPin+"'";
qry += "GROUP BY u.Name";
var userQry = sql.Query(qry).Delimit('~').First;
if(!userQry){
return false
}
var userQryArray = userQry.split('~');
var userName = userQryArray[0];
var canConfirmAdminPin = userQryArray[1];
if (canConfirmAdminPin==0){
return userName
} else {
return false
}
}
This script will lookup the entered pin and return false if pin is not valid or if correct but user does not have a role set which allows can confirm admin pin.
If the pin is correct and has permission to confirm admin pin it will return the user name for the pin.
Then all that is left is to add an extra constraint to the original void rule for command value not equals False.
This way if the script cannot find pin or doesn’t have permission and returns/passes False as command value the rule will not fire.
Anything else - ie the user name the rule triggers.
Then if not already set, adding command value to the gift state void value the user who swiped will be named as the state value;
Now even with default work period report Voids will be listed per user;