|
Have you ever wanted to send a notification
to a person or group of people notifying them of an
event that took place in Vista? Notify people of data
that was updated in Vista? Automatically update other
data fields based on data that was entered? Create tables
to make reporting easier?
All these and much, much, more can
be done by utilizing user exits. User exits are delivered
for most procedures (see Marco Padovani’s article
in the last newsletter) and these processes can be applied
with relative ease. Just look for the procedures that
end with an “X”!
The new hire user exit would be used
for any action that should be taken when someone is
hired into the system. Here are some examples of how
you may want to use new hire user exit (ACT_NEWHIRE_X):
Update a field based on the
personnel status used;
begin
update empcomp set emp_category_code =
case
when hr_status = 'E' then 'CONT'
when hr_status = 'F' then 'TEMP'
else '1REG' end
where person_id = @p_nPersonID
end
Set a user's email address;
if @p_sReasonCode in ('N NH', 'NEWHIRE')
select @mail_addr = mail_addr from emprec where person_id
= @p_nPersonID
begin
update emprec set mail_addr = lower(substring(first_name,1,1))
+ lower(last_name) + '@fulbright.com'
from fjbasic b
where emprec.person_id = b.person_id and emprec.person_id
= @p_nPersonID
end
Send an email to a group notifying
of employee information;
if @p_sReasonCode in ( 'N NH' , 'NEWHIRE')
begin
select @fullname = substring(full_name, 1,30), @prefname
= substring(pref_name,1,23), @networkid = substring(first_name,1,1)
+ substring(last_name,1,1) + empno,
@loc = substring(location_code, 1,4), @class = substring(class,
1,4), @deptabbv = substring(deptabbv, 1,5)
from fjbasich where fjbasich.person_id = @p_nPersonID
select @sBody = @sBody + '<h1>New
Hire Notification</h1>'
+ '<i>The information below is the pertinent new
hire information for this individual. All accounts will
be created using the below data.</i>' + '<BR><BR>'
+ '<b>Legal Name:</b> ' + isnull(@fullname,'')
+ '<br>'
+ '<b>Preferred Name:</b> ' + isnull(@prefname,
'') + '<br>'
+ '<b>Network ID:</b> ' + isnull(@networkid,'')
+ '<br>'
+ '<b>Location:</b> ' + isnull(@loc, '')
+ '<br>'
+ '<b>Class:</b> ' + isnull(@class,'') +
'<br>'
+ '<b>Department:</b> ' + isnull(@deptabbv,'')
select @sSubject = @sSubject + 'New Hire:
' + @fullname
select @sRecipient = @sRecipient +
case when @loc = 'HO' and @class = 'SA' then 'pdssa@fulbright.com'
when @loc = 'HO' and @class <> 'SA' then 'pdsho@fulbright.com'
when @loc = 'NY' then 'pdsny@fulbright.com'
else ''
exec Mail @sRecipient, @sSubject, @sBody,
1
end
Update a user's security;
if @p_sReasonCode in ( 'N NH' , 'NEWHIRE')
begin
update emprec set group_code =
case when class = 'PT' then 'PTGENEMP'
when class in ('AS', 'AT', 'CO', 'CS', 'OC', 'IA', 'AG')
then 'GENATY'
else 'GENEMP'
end
from fjbasic
where fjbasic.person_id = @p_nPersonID and emprec.person_id
= @p_nPersonID
end
The status change user exit (ACT_StatusChange_X)
would be used for any status changes such as a termination
or benefit status change.
Information can be deleted when
a particular status change takes place;
delete all empunion - secretarial assignments
if @p_sReasonCode like ('T %')
begin
delete from perunion
where perunion.person_id = @p_nPersonID
end
Other ideas that can be done with the
status change user exit are:
• emails sent notifying someone of terminations;
• various department heads can get messages of
terminating employees with outstanding company property;
• a benefit manager can be notified of a cobra
event so COBRA notices can be issued
These are just a few ideas. There are
user exits on many of the PDS delivered stored procedures
and code can be added to any of these. Remember
that user exits are not typically updated by PTFs; consequently,
customs do not need to be reapplied!
Please note that
although this article references Vista 3.2 code, Vista
2.4.1 has similar capabilities though the names of the
user exits may be different. (For example: The new hire
user exit in Vista 3.2 is called ACT_NewHire_X but in
2.4.1 the name is PDS_PersAction_X.)
contributed by:
Meribeth Spilger
Director of Human Resources
Fulbright & Jaworski L.L.P.
mspilger@fulbright.com
|