フロー・インスタンス名をデフォルト設定するためのビジネス・ルールを構成するにはどうすればよいですか。
アプリケーション内のOracle Visual Builder Studio (VB Studio)機能を使用して、Redwoodフロー送信ページでビジネス・ルールを設定します。
フローの送信時にフロー・インスタンス名を自動的にデフォルト設定するビジネス・ルールを設定します。
ノート:
このタスクは、VB Studioにアクセスするための適切な権限がある場合にのみ実行できます。
次に、フロー・パラメータに基づいてビジネス・ルールを構成するために使用できるコードの例をいくつか示します。
例1: フロー・パラメータに基づくフロー・インスタンス名
/* eslint-disable dot-notation */
define([], () => {
'use strict';
/**
* Default value expression for PayrollFlowInstances.InstanceName
* @param {object} context
* @return {string}
*/
function getPayrollFlowInstancesInstanceName(context) {
const { $objectContext, $fields, $modules, $user } = context;
// PAYROLL and PAYROLL_PERIOD are Base Parameters Names which can be retrived
// from My Client Groups > Payroll Flow Patterns for a flow pattern
let payroll = $fields.parameters.PAYROLL.$value();
let period = $fields.parameters.PAYROLL_PERIOD.$value();
return payroll + "|" + period;
}
return { getPayrollFlowInstancesInstanceName };
});
例2: フロー発行のユーザー名およびタイムスタンプに基づくフロー・インスタンス名
/* eslint-disable dot-notation */
define(['oj-hcm/common/js/date-utils'], (HcmDateUtils) => {
'use strict';
/**
* Default value expression for PayrollFlowInstances.InstanceName
* @param {object} context
* @return {string}
*/
function getPayrollFlowInstancesInstanceName(context) {
const { $objectContext, $fields, $modules, $user } = context;
// This function gets current Date and Time as per user preference.
function getCurrentTimeStamp() {
return HcmDateUtils.DateUtils.getUserPreferredDateString(new Date().toISOString(), true);
}
let currentDateTime = getCurrentTimeStamp();
// this line below appends username and current date time with underscore.
return $user.userName + "_" + currentDateTime;
}
return { getPayrollFlowInstancesInstanceName };
});