0% found this document useful (0 votes)
128 views

PC in Runsave Options Funclib - WF Record

The document contains code for PeopleCode functions that are used in workflow processes. It declares several functions related to workflow including functions for setting workflow status, rebuilding rowsets, notifying administrators, and determining workflow status. It also declares several global and component variables used across the workflow functions.

Uploaded by

dsanthu34
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
128 views

PC in Runsave Options Funclib - WF Record

The document contains code for PeopleCode functions that are used in workflow processes. It declares several functions related to workflow including functions for setting workflow status, rebuilding rowsets, notifying administrators, and determining workflow status. It also declares several global and component variables used across the workflow functions.

Uploaded by

dsanthu34
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 12

Declare Function

ula;
Declare Function
Declare Function
dFormula;
Declare Function
a;
Declare Function
Declare Function
Declare Function
la;
Declare Function
a;
Declare Function
ormula;
Declare Function
ormula;
Declare Function
Formula;
Declare Function
dFormula;
Declare Function
ormula;
Declare Function
ula;
Declare Function
ula;
Declare Function
la;
Declare Function
ula;
Declare Function
la;
Declare Function
mula;
Declare Function
mula;
Declare Function
eldFormula;
Declare Function
Declare Function
Declare Function
dFormula;

LoadApprovers PeopleCode FUNCLIB_WF.WF_APPR_FUNCTIONS FieldForm


WF_Call_CI PeopleCode FUNCLIB_WF.CALL_CI FieldFormula;
ApplySelfServiceData PeopleCode FUNCLIB_WF.WF_CI_FUNCTIONS Fiel
NotifyAdmin PeopleCode FUNCLIB_WF.WF_APPR_FUNCTIONS FieldFormul
BuildRowsets PeopleCode FUNCLIB_WF.BUILDROWSETS FieldFormula;
GetAdminBP PeopleCode FUNCLIB_WF.WF_GET_ADMIN_BP FieldFormula;
GetAdminList PeopleCode FUNCLIB_WF.WF_APPR_FUNCTIONS FieldFormu
SetWFStatus PeopleCode FUNCLIB_WF.WF_APPR_FUNCTIONS FieldFormul
IsNextStepAdmin PeopleCode FUNCLIB_WF.IS_NEXT_STEP_ADMIN FieldF
GetWFTransfKeys PeopleCode FUNCLIB_WF.WF_GET_TRANSF_KEYS FieldF
DisplayErrorConfirm PeopleCode FUNCLIB_HR.HR_SS_FUNCTIONS Field
DisplaySubmitConfirm PeopleCode FUNCLIB_HR.HR_SS_FUNCTIONS Fiel
DisplaySaveConfirm PeopleCode FUNCLIB_HR.HR_SS_FUNCTIONS FieldF
ReportToByAccessType PeopleCode FUNCLIB_CO.REPORTS_TO FieldForm
GetEmployeeName PeopleCode FUNCLIB_WF.WF_CI_FUNCTIONS FieldForm
BuildEmailBody PeopleCode FUNCLIB_WF.WF_CI_FUNCTIONS FieldFormu
AppendMsgDetail PeopleCode FUNCLIB_WF.WF_CI_FUNCTIONS FieldForm
BuildReviewURL PeopleCode FUNCLIB_WF.WF_CI_FUNCTIONS FieldFormu
DeleteExceptions PeopleCode FUNCLIB_WF.WF_CI_FUNCTIONS FieldFor
InsertExceptions PeopleCode FUNCLIB_WF.WF_CI_FUNCTIONS FieldFor
CreateSSExceptionArray PeopleCode FUNCLIB_WF.WF_CI_FUNCTIONS Fi
FieldExists PeopleCode FUNCLIB_WF.WF_CI_FUNCTIONS FieldFormula;
InRoleUser PeopleCode FUNCLIB_CO.REPORTS_TO FieldFormula;
GetTransactionConfig PeopleCode FUNCLIB_WF.WF_CI_FUNCTIONS Fiel

Global string &ACCESS_TYPE;


Global string &GB_GROUPID;
Component string &ExceptionTableName;
Component string &CiName;
Component string &CI_Status, &Transaction_Name, &TransactionDescr;
Component boolean &Call_CI;
Component boolean &isAdmin;
Component boolean &EmpInPosition;
Component boolean &Enabled_Flag;
Component boolean &ApprProcError;
Component string &AdminProcType;
Component string &AdminProcChoice;
Component string &AllowDBUpdt;
Component string &ReturnPanel;
Component string &ApprovalRequired, &RoleName, &ApprLogicExists;
Component Rowset &Rowset_CI, &Rowset_NO_CI;

Local Rowset &TRANSGroupRS, &GetApprovers;


Local array of Record &SSExceptionArray;
Local array of string &WFRecKeys;
Local array of array of string &WFRecKeyValues;
Component string &BaseTableName;
Component string &CollectionName;
Component string &NotifyOnSuccess;
Component string &NotifyOnWarnings;
Component Rowset &RS_WfConfig, &RS_WfConfigNotify, &RS_RoleMember;
Component string &NotifyBusinessProc, &NotifyActivity, &NotifyEvent;
Function SetGrpWFStatus(&TRANSRowset, &TransRecObj, &DatRowset, &DatRecObj);
/*bring other transactions from group into work rowset. loop through and che
ck status */
/*indicator on each row to see if the others have been processed.
*/
/*if all the transactions have been processed without error, set wf_status to
data saved.*/
/*otherwise, show status that transactions are still being handled by adminis
trator.
*/
&TRANSGroupRS = CreateRowset(@&TransRecObj);
&TransNo = &TRANSRowset.GetRow(1).GetRecord(@&TransRecObj).GetField(Field.TRA
NSACTION_NBR).Value;
&TransEmplid = &TRANSRowset.GetRow(1).GetRecord(@&TransRecObj).GetField(Field
.EMPLID).Value;
&TRANSGroupRS.Fill("WHERE Transaction_nbr = :1 and EMPLID <> :2", &TransNo, &
TransEmplid);
&one_trans_not_done = False;
For &r = 1 To &TRANSGroupRS.RowCount
&SS_STAT_INDICATOR = &TRANSGroupRS.GetRow(&r).GetRecord(@&TransRecObj).Get
Field(Field.SS_STAT_INDICATOR).Value;
If &SS_STAT_INDICATOR = "E" Or
&SS_STAT_INDICATOR = "M" Or
&SS_STAT_INDICATOR = "C" Or
&SS_STAT_INDICATOR = "B" Then;
&one_trans_not_done = True;
Break;
End-If;
End-For;
/*set WF Status based on results of CI call*/
If &one_trans_not_done = False And
All(&CI_Status) And
&ApprLogicExists = "Y" Then;
&DatRowset.GetRow(1).GetRecord(@&DatRecObj).GetField(Field.WF_STATUS).Valu
e = SetWFStatus(&CI_Status);
Else;
/*CI wasn't called. Check to see if it's an administrator and honor Admin
Overrides*/
If &one_trans_not_done = False And
None(&CI_Status) And
&ApprLogicExists = "Y" Then
If &isAdmin Then;
If All(&AdminPostnChoice) Then;
If &AdminPostnChoice = "M" Then;
&AdminSelect = "S";
Else;
&AdminSelect = &AdminPostnChoice;

End-If;
Else;
If All(&AdminSSOverride) Then;
If &AdminSSOverride = "M" Then;
&AdminSelect = "S";
Else;
&AdminSelect = &AdminSSOverride;
End-If;
Else;
If All(&AdminSbpChoice) Then;
&AdminSelect = &AdminSbpChoice;
End-If;
End-If;
End-If;
&DatRowset.GetRow(1).GetRecord(@&DatRecObj).GetField(Field.WF_STATUS
).Value = SetWFStatus(&AdminSelect);
Else;
/*CI wasn't called. It's not an admin. Assume that trans is in app
roval process*/
&DatRowset.GetRow(1).GetRecord(@&DatRecObj).GetField(Field.WF_STATUS
).Value = SetWFStatus("I");
End-If;
Else;
/*&one_trans_not_done = true*/
If &ApprLogicExists = "Y" Then;
&DatRowset.GetRow(1).GetRecord(@&DatRecObj).GetField(Field.WF_STATUS
).Value = "M";
End-If;
End-If;
End-If;
End-Function;
Function RebuildRowset(&Transaction_name, &Rowset, &RowsetRecObj, &Rowset_CI, &R
owset_NO_CI);
GetWFTransfKeys(&Transaction_name, &WFTransfKeysArray);
&numkeys = &WFTransfKeysArray.len;
For &j = 1 To &Rowset_CI.Activerowcount
&CIKeyValues = CreateArrayRept(CreateArrayRept("", 0), 0);
For &k = 1 To &numkeys;
&Fieldname = "Field." | &WFTransfKeysArray [&k][1];
&Keyvalue = &Rowset_CI.GetRow(&j).GetRecord(@&RowsetRecObj).GetField(@&
Fieldname).value;
&CIKeyValues.Push(&Fieldname);
&CIKeyValues [&k].Push(&Keyvalue);
End-For;
&CI_RS_Ind = &Rowset_CI.GetRow(&j).GetRecord(@&RowsetRecObj).GetField(Fiel
d.SS_STAT_INDICATOR).value;
/*have one row*/
For &i = 1 To &Rowset.rowcount;
For &l = 1 To &numkeys;
&Fieldname = "Field." | &WFTransfKeysArray [&l][1];
&RowsetKeyvalue = &Rowset.GetRow(&i).GetRecord(@&RowsetRecObj).GetFi
eld(@&Fieldname).value;
&CompValue = &CIKeyValues [&l][2];
If &RowsetKeyvalue = &CompValue Then;
If &l = &numkeys Then;
&row_match = &i;

&Rowset.GetRow(&row_match).GetRecord(@&RowsetRecObj).GetField(
Field.SS_STAT_INDICATOR).value = &CI_RS_Ind;
&i = &Rowset.rowcount;
End-If;
Else;
Break;
End-If;
End-For;
End-For;
End-For;
For &j = 1 To &Rowset_NO_CI.Activerowcount
&NoCIKeyValues = CreateArrayRept(CreateArrayRept("", 0), 0);
For &k = 1 To &numkeys;
&Fieldname = "Field." | &WFTransfKeysArray [&k][1];
&Keyvalue = &Rowset_NO_CI.GetRow(&j).GetRecord(@&RowsetRecObj).GetField
(@&Fieldname).value;
&NoCIKeyValues.Push(&Fieldname);
&NoCIKeyValues [&k].Push(&Keyvalue);
End-For;
&NO_CI_RS_Ind = &Rowset_NO_CI.GetRow(&j).GetRecord(@&RowsetRecObj).GetFiel
d(Field.SS_STAT_INDICATOR).value;
/*have one row*/
For &i = 1 To &Rowset.rowcount;
For &l = 1 To &numkeys;
&Fieldname = "Field." | &WFTransfKeysArray [&l][1];
&RowsetKeyvalue = &Rowset.GetRow(&i).GetRecord(@&RowsetRecObj).GetFi
eld(@&Fieldname).value;
&CompValue = &NoCIKeyValues [&l][2];
If &RowsetKeyvalue = &CompValue Then;
If &l = &numkeys Then;
&row_match = &i;
&Rowset.GetRow(&row_match).GetRecord(@&RowsetRecObj).GetField(
Field.SS_STAT_INDICATOR).value = &NO_CI_RS_Ind;
&i = &Rowset.rowcount;
End-If;
Else;
Break;
End-If;
End-For;
End-For;
End-For;
End-Function;
Function AdminPosnNotify(&DatRowset, &Rowset_NO_CI, &Transaction_Name);
/*position-managed employee. CI won't be called. manual processing required
by admin
*/
/*set derived workfield on page = admin roleusers, set ci status = manual, an
d notify admin*/
GetAdminBP(&Transaction_Name, &BusProc, &BusActivity, &BusEvent);
If &Transaction_Name = "HR_LOCATION_CHG" Then;
&MsgNum = 1;
NotifyAdmin(&DatRowset, &Rowset_NO_CI, &MsgNum, &Transaction_Name, &BusPro
c, &BusActivity, &BusEvent);
Else;
GetAdminList(&RoleName, &AdminList);
For &z = 1 To &AdminList.rowcount;
DERIVED_HR.ROLEUSER = &AdminList.GetRow(&z).GetRecord(Record.PSROLEMEMB
ER).GetField(Field.ROLEUSER).Value;
&MsgNum = 1;

NotifyAdmin(&DatRowset, &Rowset_NO_CI, &MsgNum, &Transaction_Name, &Bus


Proc, &BusActivity, &BusEvent);
End-For;
End-If;
End-Function;
Function DetermineWFStatus(&ApprovalChain) Returns string;
/*if on an administrator component...where grouped transactions are broken ap
art and worked */
/*individually...bring other transactions from group into work rowset. loop
through and check*/
/*status indicator on each row to see if the others have been processed.
*/
/*if all the transactions have been processed without error, set wf_status to
data saved.
*/
/*otherwise, show status that transactions are still being handled by adminis
trator.
*/
If All(&ApprovalChain) Then;
&ApprRecname = &ApprovalChain.DBRecordName;
&ApprRecObj = "Record." | &ApprRecname;
&Testval_Appr = &ApprovalChain.GetRow(1).GetRecord(@&ApprRecObj).GetField(
Field.EMPLID_TO).Value;
If All(&Testval_Appr) Then;
/* we're on either an approver or an administrator component*/
If &isAdmin = True Then; /* we're on an administrator component*/
&SS_Stat = "M";
Else; /* we're on an approver component*/
If DERIVED_HR.HR_WF_ACTION.Value = "DNY" Then;
&SS_Stat = "D";
Else;
&AdminIsNext = IsNextStepAdmin(&ApprovalChain);
If &AdminIsNext Then;
&SS_Stat = "M";
Else;
&SS_Stat = "I";
End-If;
End-If;
End-If;
Else;
/* we're on an originator component*/
If &ApprovalRequired = "Y" Then;
&SS_Stat = "I";
Else;
&SS_Stat = "M";
End-If;
End-If;
Else;
/*there's no approval logic built for this transaction*/
&SS_Stat = "M";
End-If;
Return &SS_Stat;
End-Function;
Function RunSaveOptions(&DatRowset As Rowset, &TRANSRowset As Rowset, &ApprovalC
hain As Rowset);

&Enabled_Flag = False;
If All(&DatRowset) Then;
&DatRecName = &DatRowset.DBRecordName;
&DatRecObj = "Record." | &DatRecName;
/* WinMessage(&DatRecObj); HR_TERM_DAT*/
&Rowset = &DatRowset;
&RowsetRecName = &DatRecName;
&RowsetRecObj = &DatRecObj;
End-If;
If All(&TRANSRowset) Then;
&TransRecName = &TRANSRowset.DBRecordName;
&TransRecObj = "Record." | &TransRecName;
WinMessage(&TransRecObj);
&Rowset = &TRANSRowset;
&RowsetRecName = &TransRecName;
&RowsetRecObj = &TransRecObj;
End-If;
WinMessage("isadmin:" | &isAdmin);
If &isAdmin = True Then;
/*only one of 3 administrator subpages will be visible at any given time.
*/
/*if employee being worked on has a position #, choice will come from SS_S
TAT_IND_POSTN
*/
/*if employee being worked does not have position #, choice will come from
SS_STAT_IND_SBP
*/
/*if errors/warnings were encountered during CI call, choice will come fro
m SS_STAT_ADM_CHOICE*/
&AdminSbpChoice = GetLevel0().GetRow(1).GetRecord(Record.WF_SS_ERR_WRK).Ge
tField(Field.SS_STAT_IND_SBP).Value;
&AdminChgStatus = GetLevel0().GetRow(1).GetRecord(Record.WF_SS_ERR_WRK).Ge
tField(Field.SS_STAT_ADM_CHOICE).Value;
&AdminPostnChoice = GetLevel0().GetRow(1).GetRecord(Record.WF_SS_ERR_WRK).
GetField(Field.SS_STAT_IND_POSTN).Value;
WinMessage("&AdminSbpChoice:" | &AdminSbpChoice | " &AdminChgStatus: " | &
AdminChgStatus | " &AdminPostnChoice:" | &AdminPostnChoice);
/*Regular update - Employee being worked isn't controlled by position*/
If All(&AdminSbpChoice) Then;
&AdminProcType = "Regular";
&AdminProcChoice = &AdminSbpChoice;
End-If;
/*Errors/warnigns were encountered during CI call*/
If All(&AdminChgStatus) Then;
&AdminProcType = "Status Override";
&AdminProcChoice = &AdminChgStatus;
End-If;
/*Position update - Employee being worked on has a position #*/
If All(&AdminPostnChoice) Then;
&AdminProcType = "Position";
&AdminProcChoice = &AdminPostnChoice;
End-If;

WinMessage("&AdminProcType:" | &AdminProcType | " &AdminProcChoice:" | &Ad


minProcChoice);
/*blank out admin choice or pass in value so that WF_Call_CI can determine
whether CI should be called or not*/
Evaluate &AdminProcChoice
When "S"; /*Success*/
Evaluate &AdminProcType
When "Status Override" /*Manual intervention required*/
&AdminChoice = "";
When-Other
&AdminChoice = "S"; /*Continue to CI*/
End-Evaluate;
When-Other;
&AdminChoice = "";
End-Evaluate;
End-If;
WinMessage("Admin choice: " | &AdminChoice);
&Call_CI = WF_Call_CI(&ApprovalChain, &Transaction_Name, &AdminChoice);
WinMessage("Call CI: " | &Call_CI);
&SS_Stat = DetermineWFStatus(&ApprovalChain);
WinMessage("Call CI: " | &Call_CI | " &SS_Stat: " | &SS_Stat);
If &Call_CI = True Then;
&Upd_emps_exist = False;
&NO_Upd_emps_exist = False;
&EmpInPosition = False;
/*position management considerations exist for the transactions below. sp
lit apart rowsets */
/*so that &Rowset_CI contains only the employees that should be put throug
h the component
*/
/*interface. The rows left in &Rowset_NO_CI will go through exception pro
cessing that will */
/*be handled manually by an administrator
*/
If &Transaction_Name = "HR_FULL_PART_CHG" Or
&Transaction_Name = "HR_LOCATION_CHG" Then;
BuildRowsets(&Rowset, &RowsetRecName, &Rowset_CI, &Rowset_NO_CI);
&Testval_CI = &Rowset_CI.GetRow(1).GetRecord(@&RowsetRecObj).GetField(F
ield.EMPLID).Value;
&Testval_NO_CI = &Rowset_NO_CI.GetRow(1).GetRecord(@&RowsetRecObj).GetF
ield(Field.EMPLID).Value;
If All(&Testval_CI) Then;
&Upd_emps_exist = True;
&EmpInPosition = False;
End-If;
If All(&Testval_NO_CI) Then;
&NO_Upd_emps_exist = True;
&EmpInPosition = True;
End-If;
If &Upd_emps_exist = True Then;
If All(&TRANSRowset) Then;

ApplySelfServiceData(&Transaction_Name, &DatRowset, &Rowset_CI, &


SSExceptionArray, &CI_Status);
Else;
ApplySelfServiceData(&Transaction_Name, &Rowset_CI, &TRANSRowset,
&SSExceptionArray, &CI_Status);
End-If;
End-If;
If &ApprLogicExists = "Y" Then
If All(&CI_Status) Then
/*if the employee is not in a position, ci will be called, ci_sta
tus will have a value*/
&DatRowset.GetRow(1).GetRecord(@&DatRecObj).GetField(Field.WF_STA
TUS).Value = SetWFStatus(&CI_Status);
Else;
/*if the employee is in a position, ci will not be called. set w
f status to "M" so that*/
/*user knows* admin is processing
*/
&DatRowset.GetRow(1).GetRecord(@&DatRecObj).GetField(Field.WF_STA
TUS).Value = SetWFStatus("M");
End-If;
End-If;
If &NO_Upd_emps_exist = True Then;
If All(&TRANSRowset) Then;
AdminPosnNotify(&DatRowset, &Rowset_NO_CI, &Transaction_Name);
Else;
AdminPosnNotify(&Rowset_NO_CI, &TRANSRowset, &Transaction_Name);
End-If;
For &m = 1 To &Rowset_NO_CI.ActiveRowCount;
If &EmpInPosition = True Then;
&Rowset_NO_CI.GetRow(&m).GetRecord(@&RowsetRecObj).GetField(Fi
eld.SS_STAT_INDICATOR).Value = "M";
Else;
&Rowset_NO_CI.GetRow(&m).GetRecord(@&RowsetRecObj).GetField(Fi
eld.SS_STAT_INDICATOR).Value = SetWFStatus(&SS_Stat);
End-If;
End-For;
End-If;
/*rebuild rowset so that it contains both ci-called and non-ci-called r
ows.*/
RebuildRowset(&Transaction_Name, &Rowset, &RowsetRecObj, &Rowset_CI, &R
owset_NO_CI);
Else;
/*transaction does not have position considerations. pass regular DAT
or Trans Rowset */
/*into ApplySelfServiceData as appropriate
*/
ApplySelfServiceData(&Transaction_Name, &DatRowset, &TRANSRowset, &SSEx
ceptionArray, &CI_Status);
End-If;
If &isAdmin = True Then;
GetLevel0().GetRow(1).GetRecord(Record.WF_SS_ERR_WRK).GetField(Field.SS
_STAT_INDICATOR).Value = &CI_Status;
End-If;
If &isAdmin = True And
All(&TRANSRowset) Then;

SetGrpWFStatus(&TRANSRowset, &TransRecObj, &DatRowset, &DatRecObj);


Else
/*set wf status to appropriate value based on whether rows were updated
via ci*/
If &ApprLogicExists = "Y" Then
If &NO_Upd_emps_exist = False And
&Upd_emps_exist = True Then;
&DatRowset.GetRow(1).GetRecord(@&DatRecObj).GetField(Field.WF_STA
TUS).Value = SetWFStatus(&CI_Status);
End-If;
If &NO_Upd_emps_exist = True And
&Upd_emps_exist = False Then;
&DatRowset.GetRow(1).GetRecord(@&DatRecObj).GetField(Field.WF_STA
TUS).Value = "M";
End-If;
If &NO_Upd_emps_exist = True And
&Upd_emps_exist = True Then;
&DatRowset.GetRow(1).GetRecord(@&DatRecObj).GetField(Field.WF_STA
TUS).Value = "M";
End-If;
End-If;
End-If;
Else;
/*call ci is false. */
If &isAdmin = True Then;
If (&AdminProcType = "Regular" Or
&AdminProcType = "Position") And
&AdminProcChoice = "M" Then;
&SS_Stat = "S";
Else;
&SS_Stat = &AdminProcChoice;
End-If;
GetLevel0().GetRow(1).GetRecord(Record.WF_SS_ERR_WRK).GetField(Field.SS
_STAT_INDICATOR).Value = &SS_Stat;
End-If;
WinMessage("apprprocerror:" | &ApprProcError);
If &ApprProcError = True Then;
&SS_Stat = "E";
&CI_Status = "E";
End-If;
For &i = 1 To &Rowset.ActiveRowCount;
&Rowset.GetRow(&i).GetRecord(@&RowsetRecObj).GetField(Field.SS_STAT_IND
ICATOR).Value = &SS_Stat;
End-For;
If &ApprLogicExists = "Y" Then;
If All(&TRANSRowset) Then;
SetGrpWFStatus(&TRANSRowset, &TransRecObj, &DatRowset, &DatRecObj);
Else;
&DatRowset.GetRow(1).GetRecord(@&DatRecObj).GetField(Field.WF_STATUS
).Value = SetWFStatus(&SS_Stat);
End-If;
End-If;
End-If;
End-Function;
Function RunWFSavePostChange(&PagenameStr As string);

/* 83SSWF - Set the correct confirmation page to be used. */


&Pagename = "Page." | &PagenameStr;
rem WinMessage("page: " | &PagenameStr | "

apprprocerror:" | &ApprProcError

);
If &ApprProcError = True Then;
DisplayErrorConfirm();
Else;
/* 83SSWF */
If &isAdmin = False Then;
If &Call_CI = True Then
If &EmpInPosition = True Then;
DisplaySubmitConfirm();
Else
If &CI_Status = "E" Or
&CI_Status = "B" Then
DisplayErrorConfirm();
Else
DisplaySaveConfirm();
End-If;
End-If;
Else
/*CALL CI IS FALSE*/
If &ApprovalRequired = "Y" Then;
TransferPage(@&Pagename);
Else;
DisplaySubmitConfirm();
End-If;
End-If;
Else;
/*it is an admin*/
&ReturnPanel = &Pagename;
If &Call_CI = True Then
If &CI_Status = "E" Or
&CI_Status = "B" Then
DisplayErrorConfirm();
Else
DisplaySaveConfirm();
End-If;
Else;
/*CALL CI IS FALSE*/
If &AdminProcType = "Status Override" Or
&AdminProcType = "Position" Then;
DisplaySaveConfirm();
Else;
DisplaySubmitConfirm();
End-If;
End-If;
End-If;
End-If;
End-Function;
/*******************************************************************************
************/
/* This function facilitates error processing when an approver is not found for
a
*/
/* transaction requiring approval.
*/

/*******************************************************************************
************/
Function ApproverNotFound(&StagedDataRecObj As Record, &NotifyBusinessProc, &Not
ifyActivity, &NotifyEvent, &RoleName, &Transaction_Name);
/* Setup message blob array*/
&MsgLineArray = CreateArrayRept("", 0);
&OriginatorName = GetEmployeeName(%EmployeeId);
/* Setup for TriggerBusinessEvent */
&BusinessProcess = "BUSPROCESS." | &NotifyBusinessProc;
&BusinessActivity = "BUSACTIVITY." | &NotifyActivity;
&BusinessEvent = "BUSEVENT." | &NotifyEvent;
/* get the folks in the administrator role into a rowset*/
&RS_RoleMember = CreateRowset(Record.PSROLEMEMBER);
&RS_RoleMember.Fill("WHERE ROLENAME = :1", &RoleName);
/* Generate "Errors" E-Mail Message, Build the E-Mail Subject Line */
HR_LBL_WRK.HR_EMAIL_SUBJECT = MsgGetExplainText(6605, 616, "Message Not Found
", &TransactionDescr, DERIVED_WF.NAME);
/* Build the E-Mail Text */
HR_LBL_WRK.HR_EMAIL_TEXT = MsgGetExplainText(6605, 615, "Message Not Found",
&TransactionDescr, DERIVED_WF.NAME, (&StagedDataRecObj.GetField(Field.EMPLID).Va
lue), &OriginatorName);
&MsgLineArray = BuildEmailBody(&Transaction_Name, &StagedDataRecObj, Null);
/* Build the "Goto" Link */
HR_LBL_WRK.HR_EMAIL_LINK = BuildReviewURL(&StagedDataRecObj, Null);
/****************************************************************/
/* The following code creates the exception array and populates */
/* the error table with the correct error message
*/
/****************************************************************/
/* Get the transaction parameters*/
GetTransactionConfig(&Transaction_Name);
/* Create the SS Application Exception Arrays */
&SSExceptionArray = CreateSSExceptionArray(&ExceptionTableName);
&SSExceptionArray.Len = 0;
&RecNameObject = "RECORD." | &ExceptionTableName;
&SSExceptionRec = CreateRecord(@(&RecNameObject));
&StagedDataRecObj.CopyFieldsTo(&SSExceptionRec);
/* Populate the additional keys. */
For &j = 1 To &SSExceptionRec.FieldCount
&Fieldname = &SSExceptionRec.GetField(&j).Name;
If Not FieldExists(&Fieldname, &StagedDataRecObj) Then
/* This is an additional field - it doesn't exist in &ExceptionRec */
&FieldValue = "";
Evaluate &Fieldname
When = "TRANSACTION_NAME"
&FieldValue = &TransactionName;

Break;
When = "MESSAGE_SET_NBR"
&FieldValue = "6605";
Break;
When = "MESSAGE_NBR"
&FieldValue = "617";
Break;
When = "MESSAGE_TEXT"
&MsgText = MsgGetExplainText(6605, 617, "Message not found");
&FieldValue = &MsgText;
Break;
End-Evaluate;
If All(&FieldValue) Then
&SSExceptionRec.GetField(&j).Value = &FieldValue;
End-If;
End-If;
End-For;
&SSExceptionArray.Push(&SSExceptionRec);
/* Delete existing rows in the exception table for this transaction's keys */
DeleteExceptions(&ExceptionTableName, &SSExceptionArray);
/* Insert exceptions into the exception table */
InsertExceptions(&ExceptionTableName, &SSExceptionArray);
/******************************/
/* end - exception processing */
/******************************/
/* Send the notification to each Role User in the administrator role*/
For &i = 1 To &RS_RoleMember.ActiveRowCount
DERIVED_HR.ROLEUSER = &RS_RoleMember.GetRow(&i).GetRecord(Record.PSROLEMEM
BER).GetField(Field.ROLEUSER).Value;
&WF_Result = TriggerBusinessEvent(@&BusinessProcess, @&BusinessActivity, @
&BusinessEvent);
End-For;
End-Function;

You might also like