承認カラムの追加
applicant_employee_key
approver_employee_key
approve_status
approve_comment
approve_datetime
approve_history
approve_datetime
Text(Parent.Default, DateTimeFormat.ShortDateTime24, "en-US")
Approve History
Substitute(Parent.Default,"&",Char(10))
approve_status
New
Edit
Delete
Approved
Rejected
申請側のsubmitボタン
IfError(
//現在のモードを取得
UpdateContext({form_mode:If(Form2.Mode=1,"New","Edit")});
SubmitForm(Form2);
//現在のレコードを検索
Set(
Now_Record,
LookUp('master_table',id=Form2.LastSubmit.id)
);
UpdateContext({approver_email:LookUp('employee_master',employee_key=Now_Record.approver_employee_key).email});
//承認ステータス&承認履歴
Patch('master_table',
{id : Form2.LastSubmit.id},
{
applicant_employee_key:LoginUserInfo.employee_key,
approve_status:form_mode,
approve_history:Now_Record.approve_history& "&" & User().FullName & " "& Text(Now(), DateTimeFormat.ShortDateTime24, "en-US")& " "&form_mode & "&"
}
);
Master_Applicant_Flow.Run("Type",form_mode,approver_email,Now_Record.id,Now_Record.id);
Notify("The request for "&If(Form2.Mode=1,"adding","editing") & "the Type Master has been submitted.",NotificationType.Success);
Navigate(MasterScreen);
,
Notify(Form2.Error,NotificationType.Error);
);
承認側のApproveボタン
UpdateContext({applicant_email:LookUp('employee_master',employee_key=Param_Record.applicant_employee_key).email});
Switch(Param_Record.approve_status,
"New",
//承認ステータス & 承認履歴
Patch(
'master_table',
{id: Param("id")},
{
approve_status: "Approved",
approve_history: Param_Record.approve_history & User().FullName & " " & Text(
Now(),
DateTimeFormat.ShortDateTime24,
"en-US"
) & " " & "Approved" & "&" & "Comment:" & DataCardValue76_1.Text & "&",
approve_comment: DataCardValue76_1.Text,
approve_datetime: Now(),
modified_by: User().Email,
modified_on: Now()
}
);
Master_Approver_Flow.Run("Type","New",applicant_email,Param_Record.id,Param_Record.name,"Approved");
Notify("Approved the request for adding the Type Master.",NotificationType.Success);
Navigate(TypeMasterApprove),
"Edit",
//承認ステータス & 承認履歴
Patch(
'master_table',
{id: Param("id")},
{
approve_status: "Approved",
approve_history: Param_Record.approve_history & User().FullName & " " & Text(
Now(),
DateTimeFormat.ShortDateTime24,
"en-US"
) & " " & "Approved" & "&" & "Comment:" & DataCardValue76_1.Text & "&",
approve_comment: DataCardValue76_1.Text,
approve_datetime: Now(),
modified_by: User().Email,
modified_on: Now()
}
);
Master_Approver_Flow.Run("Type","Edit",applicant_email,Param_Record.id,Param_Record.name,"Approved");
Notify("Approved the request for editing the Type Master.",NotificationType.Success);
Navigate(TypeMasterApprove),
"Delete",
//承認ステータス & 承認履歴
Patch(
'master_table',
{id: Param("id")},
{
approve_status: "Approved",
approve_history: Param_Record.approve_history & User().FullName & " " & Text(
Now(),
DateTimeFormat.ShortDateTime24,
"en-US"
) & " " & "Approved" & "&" & "Comment:" & DataCardValue76_1.Text & "&",
approve_comment: DataCardValue76_1.Text,
approve_datetime: Now()
}
);
Master_Approver_Flow.Run("Type","Delete",applicant_email,Param_Record.id,Param_Record.name,"Approved");
//削除
Patch(
'master_table',
{id: Param_Record.id},
{
delete_by: User().Email,
delete_on: Now(),
delete_flg: 1
}
);
Notify("Approved the request for deleting the Type Master.",NotificationType.Success);
Navigate(TypeMasterApprove);
)
StartScreen
If(
!IsBlank(Param("id")) && LookUp(
'employee_master',
email = User().Email
).role = "admin",
TypeMasterApprove,
TopScreen
);