I have a form that must be triggered from the Info
class startupPost
method, as it has to verify a condition, and if the condition is true (if it's the user's birthday), then trigger my form.
The only way I found to verify the BDay of the user is to take it from the EmplTable
. Also, I need to relate something between the EmplTable
and UserInfo
or SysUserInfo
tables in order to give me the user ID.
The problem is that I didn't find a proper way to relate the tables, because in my EmplTable
I have a DEL_userId
field which is NOT populated and not used.
In conclusion my if
block from the following chunk of code does not get executed.
Also I left The emplTable
variable intentionally not declared, as I am not sure what's the best way to declare it.
Thanks in advance for any ideas guys!
void startupPost()
{
EmplTable emplTable ; //intentionally left undeclared
int dayOfBirth = dayOfMth(emplTable.BirthDate);
int monthOfBirth = mthOfYr(emplTable.BirthDate);
int dayOfMonth = dayOfMth(systemdateget());
int monthOfYear = mthOfYr(systemdateget());
str emplName = emplTable.name();
Args args = new Args(); //formrun
FormRun formrun;
;
if (dayOfBirth == dayOfMonth && monthOfBirth == monthOfyear )
{
info("ok"); //just to verify if my loop is working
new MenuFunction(menuitemDisplayStr(NET_PALIN_001_HBDay), MenuItemType::Display).run();
// args.name(formStr(NET_PALIN_001_HBDay));
// formRun = classFactory.formRunClass(args);
// formRun.init();
// formrun.run();
}
}
Have a look at the table SysCompanyUserInfo
which maps system users from UserInfo
to employees of EmplTable
.
Below is an example to find the associated record of EmplTable
(if it exists) for the current user
static void FindCurUserEmplTable(Args _args)
{
EmplId emplId;
EmplTable emplTable;
;
emplId = EmplTable::userId2EmplId(curuserid());
if (emplId != '')
{
emplTable = EmplTable::find(emplId);
// ... your birthday logic
}
}