0
私はこのコードを書くのを助けるために2番目の目が必要です。具体的には、ワークフローを起動させない条件があります。Servicenowの承認ワークフローコード
-
部門の要求に空である時はいつでも
- 「部門」は未定義です
- スキップ承認が
- この承認ワークフローのコードを(私はこの部分を書く方法を知らない)真と偽ある場合があります。 (ないサービスカタログを通じて)servicenowのバックエンドを通じてチケットの作成を支援することです
if (gs.nil(current.assignment_group)) {
if (!gs.nil(current.variable_pool.requested_for_department)) {
department = current.variable_pool.requested_for_department;
gs.log('0 ' + current.variable_pool.requested_for_department);
}
else if (!gs.nil(current.u_requested_for.department)) {
department = current.u_requested_for.department;
gs.log('1 ' + current.u_requested_for.department);
}
//If request was not created by e-mail.
if (current.u_email_creation != 2 && gs.nil(current.assignment_group)) {
//Finds value in Catalog Appr Fulfill Group table where Requestor Department IS NOT empty.
var vardept = new GlideRecord('u_catalog_appr_fulfill_group');
vardept.addQuery('u_catalog_item', current.cat_item);
vardept.addQuery('u_requestor_department', department);
vardept.query();
gs.log('2 approver ' + department);
//If record exists and the approval group for that item is not empty and approvals are not skipped...
if (vardept.next()){
if (!gs.nil(vardept.u_catalog_item_approval_group) && vardept.u_skip_approval == false) {
//If record exists and the approval group for that item is not empty and approvals are not skipped...
//Current assignment group sets to the approval group from Catalog Appr Fulfill Group table.
current.assignment_group = vardept.u_catalog_item_approval_group;
gs.log('3 approver ');
}
}
else {
gs.log('4 approver ');
//Finds value in Catalog Appr Fulfill Group table where Requestor Department IS empty.
var vardept2 = new GlideRecord('u_catalog_appr_fulfill_group');
vardept2.addQuery('u_catalog_item', current.cat_item);
vardept2.addNullQuery('u_requestor_department');
vardept2.query();
//If record exists and the Requestors department for that item is empty and approvals are skipped...
if (vardept2.next()) {
//If record exists and the Requestors department for that item is empty and approvals are NOT skipped...
if (!gs.nil(vardept2.u_catalog_item_approval_group) && vardept2.u_skip_approval == false) {
//Set assignment group to the record's approval group from Catalog Appr Fulfill Group table.
current.assignment_group = vardept2.u_catalog_item_approval_group;
gs.log('4 approver ' + vardept2.u_catalog_item_approval_group);
}
}
else if (gs.nil(group2.u_skip_approval) && current.assignment_group == '') {
gs.log('5');
//If no record is found, set assignment group to Helpdesk Remote Approvers (For catalog items not in Catalog Appr Fulfill Group table).
current.assignment_group.setDisplayValue('Helpdesk Remote Approvers');
}
}
}
}
単純にここにコードを貼り付けるのではなく、疑念を強調する必要があります..... – Rupsingh