ActivityHistoryRecord – Global
Ein Datenobjekt, das Mitglied der Klasse WorkflowModelManager ist; ActivityHistoryRecord-Methoden vereinfachen die Interaktion mit dem WorkflowModelManager-Objekt.
Der ActivityHistoryRecord ist im Grunde eine Kopie der Daten eines GlideRecord in der Tabelle „wf_history“. Für diese Klasse sind auch einige Hilfsmethoden definiert. Für die einfachen Datenelemente dieser Klasse gibt es keine Accessoren oder Mutatoren.
ActivityHistoryRecord – addArrivedActivityToJoin(String Array activityIds)
Ändert arrivedState von bereits bekannten IDs in true.
Sobald diese Methode arrivedState bekannter IDs in „ true“ ändert, wird geprüft, ob der Join erfüllt ist. Wenn dies der Fall ist, kann der Modell-Walk fortgesetzt werden. Wenn nicht, sollte mit dem nächsten geeigneten Übergang fortgefahren werden. Diese Methode wird während der Wiedergabe als erwarteter wf_activities-Flow zum Join aufgerufen.
| Name | Typ | Beschreibung |
|---|---|---|
| activityIds | Zeichenfolgen-Array | Array von wf_activity-sys_ids, die in Richtung Join geleitet werden. |
| Typ | Beschreibung |
|---|---|
| void |
ActivityHistoryRecord – addJoinFromActivityIds(String Array activityIds)
Führt ein Seeding aller erwarteten wf_activities-sys_ids durch, von denen erwartet wird, dass sie diesen Join durchlaufen, und setzt ihren arriveState = false.
Dieser Status wird in true geändert, wenn die einzelnen erwarteten Aktivitäten in diese Instanz des Join übergehen. Diese Methode wird beim Erstellen des zwischengespeicherten Modells im Arbeitsspeicher aufgerufen. Während der Wiedergabe wird sie nicht aufgerufen.
| Name | Typ | Beschreibung |
|---|---|---|
| activityIds | Zeichenfolgen-Array | Array von wf_activity-sys_ids, die in Richtung Join geleitet werden. |
| Typ | Beschreibung |
|---|---|
| void |
ActivityHistoryRecord – addTransition(Object InTransition)
Wenn das Modell von _getExecutedTransitions() zwischengespeichert wird, fügt diese Methode Übergänge hinzu, die sich VON dieser Aktivität in Richtung der .to-Aktivität bewegt haben.
| Name | Typ | Beschreibung |
|---|---|---|
| InTransition | Objekt | ExecutedTransition-Javascript-Objekt, das dieser Aktivität hinzugefügt werden soll. |
| Typ | Beschreibung |
|---|---|
| void |
ActivityHistoryRecord – debugDump( )
Druckt Debug-Informationen.
| Name | Typ | Beschreibung |
|---|---|---|
| Keine |
| Typ | Beschreibung |
|---|---|
| void |
Das folgende Codebeispiel zeigt, wie diese Methode verwendet wird. Er verwendet die ältesten Workflow-Verlaufsdatensätze einer Basisinstanz.
// These are associated with the Change Request - Normal workflow for CHG0000037.
var wfhGR = new GlideRecord ('wf_history');
wfhGR.addQuery('context.id', '41cdb152db252200a6a2b31be0b8f527');
wfhGR.addQuery('context.table', 'change_request');
wfhGR.orderBy ('activity_index');
wfhGR.query();
while (wfhGR.next()) {
var script_name = 'AHR';
//
// Acquire the execution history of the workflow's activities.
// Do this just once while processing the first activity.
if(wfhGR.activity_index == 0) {
var model = new WorkflowModelManager( wfhGR.context );
model.getExecutedHistory();
}
//
// Access a hash of ActivityHistoryRecord javascript objects,
// hashed by the sys_id of the wf_history record.
// There will be one ActivityHistoryRecord for each activity.
var ActivityHistoryRecord = model.getActivityHistoryRecordById(wfhGR.sys_id);
//
// Use ActivityHistoryRecord methods to display selected values
gs.log('Log String [' + ActivityHistoryRecord.getLogString() + ']', script_name);
gs.log('debugDump START', script_name);
ActivityHistoryRecord.debugDump();
gs.log('debugDump END', script_name);
gs.log('Turnstile?[' + ActivityHistoryRecord.isTurnstile() + ']', script_name);
gs.log('Transition Count[' + ActivityHistoryRecord.getTransitionCount() + ']\n', script_name );
}
Ausgabe:
[0:00:00.133] Script completed in scope global: script
Script execution history and recovery available here
AHR: Log String [HISTORY RECORD: History ID:a228c4b6dba52200a6a2b31be0b8f57a History INDEX:0 History START TIME:1585659881000 History END TIME:1585659881000 WF Activity ID:e233b949cb020200d71cb9c0c24c9c1f WF Activity NAME:Begin WF Activity DEF ID:c7a5e32c0a0a0b3a002377c24ed8ea76 WF Activity DEF NAME:Begin Transition Count: 1 Is Turnstile (loop) : false Is Join: false]
AHR: debugDump START
*** Script:
*** Script: WF HISTORY RECORD:
*** Script: History ID: a228c4b6dba52200a6a2b31be0b8f57a
*** Script: History INDEX: 0
*** Script: History START TIME: 1585659881000
*** Script: History END TIME: 1585659881000
*** Script: History INDEX: 0
*** Script: WF Activity ID: e233b949cb020200d71cb9c0c24c9c1f
*** Script: WF Activity NAME: Begin
*** Script: WF Activity DEF ID: c7a5e32c0a0a0b3a002377c24ed8ea76
*** Script: WF Activity DEF NAME: Begin
*** Script: Transition Count: 1
*** Script: Roll Back Originator:
*** Script: Is Turnstile (loop): false
*** Script: Is Join: false
AHR: debugDump END
AHR: Turnstile? [false]
AHR: Transition Count [1]
AHR: Log String [HISTORY RECORD: History ID:a228c4b6dba52200a6a2b31be0b8f57d History INDEX:1 History START TIME:1585659881000 History END TIME:1585659881000 WF Activity ID:2e33b949cb020200d71cb9c0c24c9c20 WF Activity NAME:Change moves to Assess WF Activity DEF ID:d93a02ae0a0a0aa30077abad3fdac035 WF Activity DEF NAME:Wait for condition Transition Count: 1 Is Turnstile (loop) : false Is Join: false]
AHR: debugDump START
*** Script:
*** Script: WF HISTORY RECORD:
*** Script: History ID: a228c4b6dba52200a6a2b31be0b8f57d
*** Script: History INDEX: 1
*** Script: History START TIME: 1585659881000
*** Script: History END TIME: 1585659881000
*** Script: History INDEX: 1
*** Script: WF Activity ID: 2e33b949cb020200d71cb9c0c24c9c20
*** Script: WF Activity NAME: Change moves to Assess
*** Script: WF Activity DEF ID: d93a02ae0a0a0aa30077abad3fdac035
*** Script: WF Activity DEF NAME: Wait for condition
*** Script: Transition Count: 1
*** Script: Roll Back Originator:
*** Script: Is Turnstile (loop): false
*** Script: Is Join: false
AHR: debugDump END
AHR: Turnstile? [false]
AHR: Transition Count [1]
AHR: Log String [HISTORY RECORD: History ID:3e28c4b6dba52200a6a2b31be0b8f57e History INDEX:2 History START TIME:1585659881000 History END TIME:1585659881000 WF Activity ID:6e33b949cb020200d71cb9c0c24c9c1f WF Activity NAME:Requested WF Activity DEF ID:50a78fa50a6a803f66d064255f7201a5 WF Activity DEF NAME:Approval Action Transition Count: 1 Is Turnstile (loop) : false Is Join: false]
AHR: debugDump START
*** Script:
*** Script: WF HISTORY RECORD:
*** Script: History ID: 3e28c4b6dba52200a6a2b31be0b8f57e
*** Script: History INDEX: 2
*** Script: History START TIME: 1585659881000
*** Script: History END TIME: 1585659881000
*** Script: History INDEX: 2
*** Script: WF Activity ID: 6e33b949cb020200d71cb9c0c24c9c1f
*** Script: WF Activity NAME: Requested
*** Script: WF Activity DEF ID: 50a78fa50a6a803f66d064255f7201a5
*** Script: WF Activity DEF NAME: Approval Action
*** Script: Transition Count: 1
*** Script: Roll Back Originator:
*** Script: Is Turnstile (loop): false
*** Script: Is Join: false
AHR: debugDump END
AHR: Turnstile? [false]
AHR: Transition Count [1]
AHR: Log String [HISTORY RECORD: History ID:0d38c4b6dba52200a6a2b31be0b8f5cc History INDEX:3 History START TIME:1585659881000 History END TIME:1585659891000 WF Activity ID:2a33b949cb020200d71cb9c0c24c9c26 WF Activity NAME:Technical approvals WF Activity DEF ID:354e911f0a0a029a00e6a0e6ad74206f WF Activity DEF NAME:Approval - Group Transition Count: 1 Is Turnstile (loop) : false Is Join: false]
AHR: debugDump START
*** Script:
*** Script: WF HISTORY RECORD:
*** Script: History ID: 0d38c4b6dba52200a6a2b31be0b8f5cc
*** Script: History INDEX: 3
*** Script: History START TIME: 1585659881000
*** Script: History END TIME: 1585659891000
*** Script: History INDEX: 3
*** Script: WF Activity ID: 2a33b949cb020200d71cb9c0c24c9c26
*** Script: WF Activity NAME: Technical approvals
*** Script: WF Activity DEF ID: 354e911f0a0a029a00e6a0e6ad74206f
*** Script: WF Activity DEF NAME: Approval - Group
*** Script: Transition Count: 1
*** Script: Roll Back Originator:
*** Script: Is Turnstile (loop): false
*** Script: Is Join: false
AHR: debugDump END
AHR: Turnstile? [false]
AHR: Transition Count [1]
AHR: Log String [HISTORY RECORD: History ID:c538c4b6dba52200a6a2b31be0b8f5ce History INDEX:4 History START TIME:1585659891000 History END TIME:1585659891000 WF Activity ID:6233b949cb020200d71cb9c0c24c9c5b WF Activity NAME:Check if Change is "On hold" WF Activity DEF ID:98f621ca0a0a0b5900f7c291f5e45a0e WF Activity DEF NAME:If Transition Count: 1 Is Turnstile (loop) : false Is Join: false]
AHR: debugDump START
*** Script:
*** Script: WF HISTORY RECORD:
*** Script: History ID: c538c4b6dba52200a6a2b31be0b8f5ce
*** Script: History INDEX: 4
*** Script: History START TIME: 1585659891000
*** Script: History END TIME: 1585659891000
*** Script: History INDEX: 4
*** Script: WF Activity ID: 6233b949cb020200d71cb9c0c24c9c5b
*** Script: WF Activity NAME: Check if Change is "On hold"
*** Script: WF Activity DEF ID: 98f621ca0a0a0b5900f7c291f5e45a0e
*** Script: WF Activity DEF NAME: If
*** Script: Transition Count: 1
*** Script: Roll Back Originator:
*** Script: Is Turnstile (loop): false
*** Script: Is Join: false
AHR: debugDump END
AHR: Turnstile? [false]
AHR: Transition Count [1]
AHR: Log String [HISTORY RECORD: History ID:cd3808b6dba52200a6a2b31be0b8f501 History INDEX:5 History START TIME:1585659891000 History END TIME:1585659891000 WF Activity ID:e633b949cb020200d71cb9c0c24c9c20 WF Activity NAME:Move to Authorize WF Activity DEF ID:1ca8d7cf0a0a0b265e9a000c2c08248c WF Activity DEF NAME:Set Values Transition Count: 1 Is Turnstile (loop) : false Is Join: false]
AHR: debugDump START
*** Script:
*** Script: WF HISTORY RECORD:
*** Script: History ID: cd3808b6dba52200a6a2b31be0b8f501
*** Script: History INDEX: 5
*** Script: History START TIME: 1585659891000
*** Script: History END TIME: 1585659891000
*** Script: History INDEX: 5
*** Script: WF Activity ID: e633b949cb020200d71cb9c0c24c9c20
*** Script: WF Activity NAME: Move to Authorize
*** Script: WF Activity DEF ID: 1ca8d7cf0a0a0b265e9a000c2c08248c
*** Script: WF Activity DEF NAME: Set Values
*** Script: Transition Count: 1
*** Script: Roll Back Originator:
*** Script: Is Turnstile (loop): false
*** Script: Is Join: false
AHR: debugDump END
AHR: Turnstile? [false]
AHR: Transition Count [1]
ActivityHistoryRecord – startsJoinContainActivity( )
Testet die eingehende wf_activity-sys_id, von deren Seeding in diesem Verlaufsdatensatz ausgegangen wird. Wenn dies der Fall ist, wird geprüft, ob es eine Aktivität ist, die diesen Join durchlaufen würde.
| Name | Typ | Beschreibung |
|---|---|---|
| Keine |
| Typ | Beschreibung |
|---|---|
| Boolean | „True“, wenn es eine Aktivität ist, die diesen Join durchlaufen würde. |
ActivityHistoryRecord – getLogString( )
Gibt die Protokollzeichenfolge aus dem Verlaufsdatensatz zurück.
| Name | Typ | Beschreibung |
|---|---|---|
| Keine |
| Typ | Beschreibung |
|---|---|
| Zeichenfolge | Die Protokollzeichenfolge. |
Das folgende Codebeispiel zeigt, wie diese Methode verwendet wird. Er verwendet die ältesten Workflow-Verlaufsdatensätze einer Basisinstanz.
// These are associated with the Change Request - Normal workflow for CHG0000037.
var wfhGR = new GlideRecord ('wf_history');
wfhGR.addQuery('context.id', '41cdb152db252200a6a2b31be0b8f527');
wfhGR.addQuery('context.table', 'change_request');
wfhGR.orderBy ('activity_index');
wfhGR.query();
while (wfhGR.next()) {
var script_name = 'AHR';
//
// Acquire the execution history of the workflow's activities.
// Do this just once while processing the first activity.
if(wfhGR.activity_index == 0) {
var model = new WorkflowModelManager( wfhGR.context );
model.getExecutedHistory();
}
//
// Access a hash of ActivityHistoryRecord javascript objects,
// hashed by the sys_id of the wf_history record.
// There will be one ActivityHistoryRecord for each activity.
var ActivityHistoryRecord = model.getActivityHistoryRecordById(wfhGR.sys_id);
//
// Use ActivityHistoryRecord methods to display selected values
gs.log('Log String [' + ActivityHistoryRecord.getLogString() + ']', script_name);
gs.log('debugDump START', script_name);
ActivityHistoryRecord.debugDump();
gs.log('debugDump END', script_name);
gs.log('Turnstile?[' + ActivityHistoryRecord.isTurnstile() + ']', script_name);
gs.log('Transition Count[' + ActivityHistoryRecord.getTransitionCount() + ']\n', script_name );
}
Ausgabe:
[0:00:00.133] Script completed in scope global: script
Script execution history and recovery available here
AHR: Log String [HISTORY RECORD: History ID:a228c4b6dba52200a6a2b31be0b8f57a History INDEX:0 History START TIME:1585659881000 History END TIME:1585659881000 WF Activity ID:e233b949cb020200d71cb9c0c24c9c1f WF Activity NAME:Begin WF Activity DEF ID:c7a5e32c0a0a0b3a002377c24ed8ea76 WF Activity DEF NAME:Begin Transition Count: 1 Is Turnstile (loop) : false Is Join: false]
AHR: debugDump START
*** Script:
*** Script: WF HISTORY RECORD:
*** Script: History ID: a228c4b6dba52200a6a2b31be0b8f57a
*** Script: History INDEX: 0
*** Script: History START TIME: 1585659881000
*** Script: History END TIME: 1585659881000
*** Script: History INDEX: 0
*** Script: WF Activity ID: e233b949cb020200d71cb9c0c24c9c1f
*** Script: WF Activity NAME: Begin
*** Script: WF Activity DEF ID: c7a5e32c0a0a0b3a002377c24ed8ea76
*** Script: WF Activity DEF NAME: Begin
*** Script: Transition Count: 1
*** Script: Roll Back Originator:
*** Script: Is Turnstile (loop): false
*** Script: Is Join: false
AHR: debugDump END
AHR: Turnstile? [false]
AHR: Transition Count [1]
AHR: Log String [HISTORY RECORD: History ID:a228c4b6dba52200a6a2b31be0b8f57d History INDEX:1 History START TIME:1585659881000 History END TIME:1585659881000 WF Activity ID:2e33b949cb020200d71cb9c0c24c9c20 WF Activity NAME:Change moves to Assess WF Activity DEF ID:d93a02ae0a0a0aa30077abad3fdac035 WF Activity DEF NAME:Wait for condition Transition Count: 1 Is Turnstile (loop) : false Is Join: false]
AHR: debugDump START
*** Script:
*** Script: WF HISTORY RECORD:
*** Script: History ID: a228c4b6dba52200a6a2b31be0b8f57d
*** Script: History INDEX: 1
*** Script: History START TIME: 1585659881000
*** Script: History END TIME: 1585659881000
*** Script: History INDEX: 1
*** Script: WF Activity ID: 2e33b949cb020200d71cb9c0c24c9c20
*** Script: WF Activity NAME: Change moves to Assess
*** Script: WF Activity DEF ID: d93a02ae0a0a0aa30077abad3fdac035
*** Script: WF Activity DEF NAME: Wait for condition
*** Script: Transition Count: 1
*** Script: Roll Back Originator:
*** Script: Is Turnstile (loop): false
*** Script: Is Join: false
AHR: debugDump END
AHR: Turnstile? [false]
AHR: Transition Count [1]
AHR: Log String [HISTORY RECORD: History ID:3e28c4b6dba52200a6a2b31be0b8f57e History INDEX:2 History START TIME:1585659881000 History END TIME:1585659881000 WF Activity ID:6e33b949cb020200d71cb9c0c24c9c1f WF Activity NAME:Requested WF Activity DEF ID:50a78fa50a6a803f66d064255f7201a5 WF Activity DEF NAME:Approval Action Transition Count: 1 Is Turnstile (loop) : false Is Join: false]
AHR: debugDump START
*** Script:
*** Script: WF HISTORY RECORD:
*** Script: History ID: 3e28c4b6dba52200a6a2b31be0b8f57e
*** Script: History INDEX: 2
*** Script: History START TIME: 1585659881000
*** Script: History END TIME: 1585659881000
*** Script: History INDEX: 2
*** Script: WF Activity ID: 6e33b949cb020200d71cb9c0c24c9c1f
*** Script: WF Activity NAME: Requested
*** Script: WF Activity DEF ID: 50a78fa50a6a803f66d064255f7201a5
*** Script: WF Activity DEF NAME: Approval Action
*** Script: Transition Count: 1
*** Script: Roll Back Originator:
*** Script: Is Turnstile (loop): false
*** Script: Is Join: false
AHR: debugDump END
AHR: Turnstile? [false]
AHR: Transition Count [1]
AHR: Log String [HISTORY RECORD: History ID:0d38c4b6dba52200a6a2b31be0b8f5cc History INDEX:3 History START TIME:1585659881000 History END TIME:1585659891000 WF Activity ID:2a33b949cb020200d71cb9c0c24c9c26 WF Activity NAME:Technical approvals WF Activity DEF ID:354e911f0a0a029a00e6a0e6ad74206f WF Activity DEF NAME:Approval - Group Transition Count: 1 Is Turnstile (loop) : false Is Join: false]
AHR: debugDump START
*** Script:
*** Script: WF HISTORY RECORD:
*** Script: History ID: 0d38c4b6dba52200a6a2b31be0b8f5cc
*** Script: History INDEX: 3
*** Script: History START TIME: 1585659881000
*** Script: History END TIME: 1585659891000
*** Script: History INDEX: 3
*** Script: WF Activity ID: 2a33b949cb020200d71cb9c0c24c9c26
*** Script: WF Activity NAME: Technical approvals
*** Script: WF Activity DEF ID: 354e911f0a0a029a00e6a0e6ad74206f
*** Script: WF Activity DEF NAME: Approval - Group
*** Script: Transition Count: 1
*** Script: Roll Back Originator:
*** Script: Is Turnstile (loop): false
*** Script: Is Join: false
AHR: debugDump END
AHR: Turnstile? [false]
AHR: Transition Count [1]
AHR: Log String [HISTORY RECORD: History ID:c538c4b6dba52200a6a2b31be0b8f5ce History INDEX:4 History START TIME:1585659891000 History END TIME:1585659891000 WF Activity ID:6233b949cb020200d71cb9c0c24c9c5b WF Activity NAME:Check if Change is "On hold" WF Activity DEF ID:98f621ca0a0a0b5900f7c291f5e45a0e WF Activity DEF NAME:If Transition Count: 1 Is Turnstile (loop) : false Is Join: false]
AHR: debugDump START
*** Script:
*** Script: WF HISTORY RECORD:
*** Script: History ID: c538c4b6dba52200a6a2b31be0b8f5ce
*** Script: History INDEX: 4
*** Script: History START TIME: 1585659891000
*** Script: History END TIME: 1585659891000
*** Script: History INDEX: 4
*** Script: WF Activity ID: 6233b949cb020200d71cb9c0c24c9c5b
*** Script: WF Activity NAME: Check if Change is "On hold"
*** Script: WF Activity DEF ID: 98f621ca0a0a0b5900f7c291f5e45a0e
*** Script: WF Activity DEF NAME: If
*** Script: Transition Count: 1
*** Script: Roll Back Originator:
*** Script: Is Turnstile (loop): false
*** Script: Is Join: false
AHR: debugDump END
AHR: Turnstile? [false]
AHR: Transition Count [1]
AHR: Log String [HISTORY RECORD: History ID:cd3808b6dba52200a6a2b31be0b8f501 History INDEX:5 History START TIME:1585659891000 History END TIME:1585659891000 WF Activity ID:e633b949cb020200d71cb9c0c24c9c20 WF Activity NAME:Move to Authorize WF Activity DEF ID:1ca8d7cf0a0a0b265e9a000c2c08248c WF Activity DEF NAME:Set Values Transition Count: 1 Is Turnstile (loop) : false Is Join: false]
AHR: debugDump START
*** Script:
*** Script: WF HISTORY RECORD:
*** Script: History ID: cd3808b6dba52200a6a2b31be0b8f501
*** Script: History INDEX: 5
*** Script: History START TIME: 1585659891000
*** Script: History END TIME: 1585659891000
*** Script: History INDEX: 5
*** Script: WF Activity ID: e633b949cb020200d71cb9c0c24c9c20
*** Script: WF Activity NAME: Move to Authorize
*** Script: WF Activity DEF ID: 1ca8d7cf0a0a0b265e9a000c2c08248c
*** Script: WF Activity DEF NAME: Set Values
*** Script: Transition Count: 1
*** Script: Roll Back Originator:
*** Script: Is Turnstile (loop): false
*** Script: Is Join: false
AHR: debugDump END
AHR: Turnstile? [false]
AHR: Transition Count [1]
ActivityHistoryRecord – getSatisfiedJoinActivities( )
Gibt die sys_ids der Verlaufsdatensätze zurück, die zu dieser Join-Aktivität übergehen und sie bereits durchlaufen haben.
| Name | Typ | Beschreibung |
|---|---|---|
| Keine |
| Typ | Beschreibung |
|---|---|
| Zeichenfolgen-Array | Array von sys_ids der Verlaufsdatensätze, die zu dieser Join-Aktivität übergehen. |
ActivityHistoryRecord – getTransitionCount( )
Gibt die Übergangsanzahl für diese Aktivität zurück.
| Name | Typ | Beschreibung |
|---|---|---|
| Keine |
| Typ | Beschreibung |
|---|---|
| Zahl | Anzahl der Übergänge von dieser Aktivität. |
Das folgende Codebeispiel zeigt, wie diese Methode verwendet wird. Er verwendet die ältesten Workflow-Verlaufsdatensätze einer Basisinstanz.
// These are associated with the Change Request - Normal workflow for CHG0000037.
var wfhGR = new GlideRecord ('wf_history');
wfhGR.addQuery('context.id', '41cdb152db252200a6a2b31be0b8f527');
wfhGR.addQuery('context.table', 'change_request');
wfhGR.orderBy ('activity_index');
wfhGR.query();
while (wfhGR.next()) {
var script_name = 'AHR';
//
// Acquire the execution history of the workflow's activities.
// Do this just once while processing the first activity.
if(wfhGR.activity_index == 0) {
var model = new WorkflowModelManager( wfhGR.context );
model.getExecutedHistory();
}
//
// Access a hash of ActivityHistoryRecord javascript objects,
// hashed by the sys_id of the wf_history record.
// There will be one ActivityHistoryRecord for each activity.
var ActivityHistoryRecord = model.getActivityHistoryRecordById(wfhGR.sys_id);
//
// Use ActivityHistoryRecord methods to display selected values
gs.log('Log String [' + ActivityHistoryRecord.getLogString() + ']', script_name);
gs.log('debugDump START', script_name);
ActivityHistoryRecord.debugDump();
gs.log('debugDump END', script_name);
gs.log('Turnstile?[' + ActivityHistoryRecord.isTurnstile() + ']', script_name);
gs.log('Transition Count[' + ActivityHistoryRecord.getTransitionCount() + ']\n', script_name );
}
Ausgabe:
[0:00:00.133] Script completed in scope global: script
Script execution history and recovery available here
AHR: Log String [HISTORY RECORD: History ID:a228c4b6dba52200a6a2b31be0b8f57a History INDEX:0 History START TIME:1585659881000 History END TIME:1585659881000 WF Activity ID:e233b949cb020200d71cb9c0c24c9c1f WF Activity NAME:Begin WF Activity DEF ID:c7a5e32c0a0a0b3a002377c24ed8ea76 WF Activity DEF NAME:Begin Transition Count: 1 Is Turnstile (loop) : false Is Join: false]
AHR: debugDump START
*** Script:
*** Script: WF HISTORY RECORD:
*** Script: History ID: a228c4b6dba52200a6a2b31be0b8f57a
*** Script: History INDEX: 0
*** Script: History START TIME: 1585659881000
*** Script: History END TIME: 1585659881000
*** Script: History INDEX: 0
*** Script: WF Activity ID: e233b949cb020200d71cb9c0c24c9c1f
*** Script: WF Activity NAME: Begin
*** Script: WF Activity DEF ID: c7a5e32c0a0a0b3a002377c24ed8ea76
*** Script: WF Activity DEF NAME: Begin
*** Script: Transition Count: 1
*** Script: Roll Back Originator:
*** Script: Is Turnstile (loop): false
*** Script: Is Join: false
AHR: debugDump END
AHR: Turnstile? [false]
AHR: Transition Count [1]
AHR: Log String [HISTORY RECORD: History ID:a228c4b6dba52200a6a2b31be0b8f57d History INDEX:1 History START TIME:1585659881000 History END TIME:1585659881000 WF Activity ID:2e33b949cb020200d71cb9c0c24c9c20 WF Activity NAME:Change moves to Assess WF Activity DEF ID:d93a02ae0a0a0aa30077abad3fdac035 WF Activity DEF NAME:Wait for condition Transition Count: 1 Is Turnstile (loop) : false Is Join: false]
AHR: debugDump START
*** Script:
*** Script: WF HISTORY RECORD:
*** Script: History ID: a228c4b6dba52200a6a2b31be0b8f57d
*** Script: History INDEX: 1
*** Script: History START TIME: 1585659881000
*** Script: History END TIME: 1585659881000
*** Script: History INDEX: 1
*** Script: WF Activity ID: 2e33b949cb020200d71cb9c0c24c9c20
*** Script: WF Activity NAME: Change moves to Assess
*** Script: WF Activity DEF ID: d93a02ae0a0a0aa30077abad3fdac035
*** Script: WF Activity DEF NAME: Wait for condition
*** Script: Transition Count: 1
*** Script: Roll Back Originator:
*** Script: Is Turnstile (loop): false
*** Script: Is Join: false
AHR: debugDump END
AHR: Turnstile? [false]
AHR: Transition Count [1]
AHR: Log String [HISTORY RECORD: History ID:3e28c4b6dba52200a6a2b31be0b8f57e History INDEX:2 History START TIME:1585659881000 History END TIME:1585659881000 WF Activity ID:6e33b949cb020200d71cb9c0c24c9c1f WF Activity NAME:Requested WF Activity DEF ID:50a78fa50a6a803f66d064255f7201a5 WF Activity DEF NAME:Approval Action Transition Count: 1 Is Turnstile (loop) : false Is Join: false]
AHR: debugDump START
*** Script:
*** Script: WF HISTORY RECORD:
*** Script: History ID: 3e28c4b6dba52200a6a2b31be0b8f57e
*** Script: History INDEX: 2
*** Script: History START TIME: 1585659881000
*** Script: History END TIME: 1585659881000
*** Script: History INDEX: 2
*** Script: WF Activity ID: 6e33b949cb020200d71cb9c0c24c9c1f
*** Script: WF Activity NAME: Requested
*** Script: WF Activity DEF ID: 50a78fa50a6a803f66d064255f7201a5
*** Script: WF Activity DEF NAME: Approval Action
*** Script: Transition Count: 1
*** Script: Roll Back Originator:
*** Script: Is Turnstile (loop): false
*** Script: Is Join: false
AHR: debugDump END
AHR: Turnstile? [false]
AHR: Transition Count [1]
AHR: Log String [HISTORY RECORD: History ID:0d38c4b6dba52200a6a2b31be0b8f5cc History INDEX:3 History START TIME:1585659881000 History END TIME:1585659891000 WF Activity ID:2a33b949cb020200d71cb9c0c24c9c26 WF Activity NAME:Technical approvals WF Activity DEF ID:354e911f0a0a029a00e6a0e6ad74206f WF Activity DEF NAME:Approval - Group Transition Count: 1 Is Turnstile (loop) : false Is Join: false]
AHR: debugDump START
*** Script:
*** Script: WF HISTORY RECORD:
*** Script: History ID: 0d38c4b6dba52200a6a2b31be0b8f5cc
*** Script: History INDEX: 3
*** Script: History START TIME: 1585659881000
*** Script: History END TIME: 1585659891000
*** Script: History INDEX: 3
*** Script: WF Activity ID: 2a33b949cb020200d71cb9c0c24c9c26
*** Script: WF Activity NAME: Technical approvals
*** Script: WF Activity DEF ID: 354e911f0a0a029a00e6a0e6ad74206f
*** Script: WF Activity DEF NAME: Approval - Group
*** Script: Transition Count: 1
*** Script: Roll Back Originator:
*** Script: Is Turnstile (loop): false
*** Script: Is Join: false
AHR: debugDump END
AHR: Turnstile? [false]
AHR: Transition Count [1]
AHR: Log String [HISTORY RECORD: History ID:c538c4b6dba52200a6a2b31be0b8f5ce History INDEX:4 History START TIME:1585659891000 History END TIME:1585659891000 WF Activity ID:6233b949cb020200d71cb9c0c24c9c5b WF Activity NAME:Check if Change is "On hold" WF Activity DEF ID:98f621ca0a0a0b5900f7c291f5e45a0e WF Activity DEF NAME:If Transition Count: 1 Is Turnstile (loop) : false Is Join: false]
AHR: debugDump START
*** Script:
*** Script: WF HISTORY RECORD:
*** Script: History ID: c538c4b6dba52200a6a2b31be0b8f5ce
*** Script: History INDEX: 4
*** Script: History START TIME: 1585659891000
*** Script: History END TIME: 1585659891000
*** Script: History INDEX: 4
*** Script: WF Activity ID: 6233b949cb020200d71cb9c0c24c9c5b
*** Script: WF Activity NAME: Check if Change is "On hold"
*** Script: WF Activity DEF ID: 98f621ca0a0a0b5900f7c291f5e45a0e
*** Script: WF Activity DEF NAME: If
*** Script: Transition Count: 1
*** Script: Roll Back Originator:
*** Script: Is Turnstile (loop): false
*** Script: Is Join: false
AHR: debugDump END
AHR: Turnstile? [false]
AHR: Transition Count [1]
AHR: Log String [HISTORY RECORD: History ID:cd3808b6dba52200a6a2b31be0b8f501 History INDEX:5 History START TIME:1585659891000 History END TIME:1585659891000 WF Activity ID:e633b949cb020200d71cb9c0c24c9c20 WF Activity NAME:Move to Authorize WF Activity DEF ID:1ca8d7cf0a0a0b265e9a000c2c08248c WF Activity DEF NAME:Set Values Transition Count: 1 Is Turnstile (loop) : false Is Join: false]
AHR: debugDump START
*** Script:
*** Script: WF HISTORY RECORD:
*** Script: History ID: cd3808b6dba52200a6a2b31be0b8f501
*** Script: History INDEX: 5
*** Script: History START TIME: 1585659891000
*** Script: History END TIME: 1585659891000
*** Script: History INDEX: 5
*** Script: WF Activity ID: e633b949cb020200d71cb9c0c24c9c20
*** Script: WF Activity NAME: Move to Authorize
*** Script: WF Activity DEF ID: 1ca8d7cf0a0a0b265e9a000c2c08248c
*** Script: WF Activity DEF NAME: Set Values
*** Script: Transition Count: 1
*** Script: Roll Back Originator:
*** Script: Is Turnstile (loop): false
*** Script: Is Join: false
AHR: debugDump END
AHR: Turnstile? [false]
AHR: Transition Count [1]
ActivityHistoryRecord – getUnSatisfiedJoinActivities( )
Gibt die sys_ids der Verlaufsdatensätze zurück, die zu dieser Join-Aktivität übergehen und auf die der Join noch wartet.
| Name | Typ | Beschreibung |
|---|---|---|
| Keine |
| Typ | Beschreibung |
|---|---|
| Zeichenfolgen-Array | Array von sys_ids der Verlaufsdatensätze, die zu dieser Join-Aktivität übergehen. |
ActivityHistoryRecord – isARollback( )
Bestimmt, ob diese Aktivität eine der Rollback-Aktivitäten ist.
| Name | Typ | Beschreibung |
|---|---|---|
| Keine |
| Typ | Beschreibung |
|---|---|
| Boolean | Kennzeichnung, die angibt, ob die Aktivität eine der Rollback-Aktivitäten ist. Gültige Werte:
|
ActivityHistoryRecord – isIdADestination(String ahrSys_id)
Bestimmt, ob die übergebene sys_id ein Ziel einer der Übergänge ist, die dieser Instanz eines ActivityHistoryRecord zugeordnet sind.
| Name | Typ | Beschreibung |
|---|---|---|
| ahrSys_id | Zeichenfolge | Sys_id eines Aktivitätsverlaufs aus der Tabelle „wf_history“. |
| Typ | Beschreibung |
|---|---|
| Boolean | „True“, wenn die übergebene sys_id das Ziel eines der Übergänge ist. |
ActivityHistoryRecord – isJoin( )
Bestimmt, ob diese Aktivität ein Join ist.
| Name | Typ | Beschreibung |
|---|---|---|
| Keine |
| Typ | Beschreibung |
|---|---|
| Boolean | „True“, wenn die Aktivität ein Join ist. |
ActivityHistoryRecord – isJoinSatisfied( )
Untersucht den Wert von arrivalState.
Wird während der Wiedergabe aufgerufen, wenn der Übergang zur sys_id eines Übergangs auf eine Aktivität verweist, die ein Join ist.
| Name | Typ | Beschreibung |
|---|---|---|
| Keine |
| Typ | Beschreibung |
|---|---|
| Boolean | „True“, wenn dem Join genügt wird. |
ActivityHistoryRecord – isJoinWaitingForActivity(String Array activityIds)
Testet die eingehende wf_activity-sys_id, von deren Seeding in diesem Verlaufsdatensatz ausgegangen wird.
Wenn dies der Fall ist, wird geprüft, ob sie den Join bereits durchlaufen hat. Wenn dies der Fall ist, wartet dieser Join nicht auf diese Aktivität und sollte weiter unten nach der wartenden suchen. Dieser Test wird nacheinander aufgerufen, während das Modell durchlaufen wird. In den Fällen von Rollbacks und Schleifen wird daher davon ausgegangen. Wenn die sys_id hier enthalten und das Flag true ist, befindet sich dieser wartenden Join weiter oben in der Sequenz. Diese Art der Überprüfung ist erforderlich, da die Verlaufsdatensätze von Joins aus der Verlaufstabelle entfernt werden. Daher ist es möglich, dass ein Datensatz in der Übergangstabelle enthalten ist und über keine Übereinstimmung in der entsprechenden Verlaufstabelle verfügt, aber trotzdem eine angemessene Übereinstimmung für eine zuvor ausgeführte Instanz desselben Join ist.
| Name | Typ | Beschreibung |
|---|---|---|
| activityIds | Zeichenfolgen-Array | Array von wf_activity-sys_ids, die in Richtung Join geleitet werden. |
| Typ | Beschreibung |
|---|---|
| Boolean | „True“, wenn die Aktivität den Join bereits durchlaufen hat. |
ActivityHistoryRecord – isRolledBack( )
Bestimmt, ob dieser Workflow zurückgesetzt wurde.
| Name | Typ | Beschreibung |
|---|---|---|
| Keine |
| Typ | Beschreibung |
|---|---|
| Boolean | „True“, wenn dieser Workflow zurückgesetzt wurde. |
ActivityHistoryRecord – isTournstile( )
Bestimmt, ob die aktuelle Aktivität ein Drehkreuz ist.
| Name | Typ | Beschreibung |
|---|---|---|
| Keine |
| Typ | Beschreibung |
|---|---|
| Boolean | Kennzeichnung, die angibt, ob die Aktivität ein Drehkreuzist. Gültige Werte:
|
Das folgende Codebeispiel zeigt, wie diese Methode zum Erkennen eines Drehkreuzes verwendet wird. Sie basiert auf dem Workflow in der Workflow-Aktivität Rollback zu. Sie können die Ausgabe dieses Skripts überprüfen, indem Sie die Registerkarte „ Workflow-Aktivitätsverlauf “ überprüfen, wenn Sie Workflow im Formular „Angeforderte Elemente“ (RITM) anzeigen.
var wfhGR = new GlideRecord ('wf_history');
wfhGR.addQuery ('context.id','cc45480d2f9b8110b99eb2e72799b6f9'); // sys_id of the RITM
wfhGR.addQuery ('context.table','sc_req_item'); // Table for the RITM
wfhGR.orderBy ('activity_index');
wfhGR.query();
var turnstile_count = 0;
while (wfhGR.next()) {
var script_name = 'AHR';
//
// Acquire the execution history of the workflow's activities.
// Do this just once while processing the first activity.
if(wfhGR.activity_index == 0) {
var model = new WorkflowModelManager(wfhGR.context);
model.getExecutedHistory();
}
//
// Access a hash of ActivityHistoryRecord javascript objects,
// hashed by the sys_id of the wf_history record.
// There will be one ActivityHistoryRecord for each activity.
var ActivityHistoryRecord = model.getActivityHistoryRecordById(wfhGR.sys_id);
//
// Use ActivityHistoryRecord methods to display turnstile activities.
if(ActivityHistoryRecord.isTurnstile()) {
var log_string = ActivityHistoryRecord.getLogString();
var name_start = log_string.indexOf('WF Activity NAME:');
var name_end = log_string.indexOf('WF Activity DEF ID:');
var name = log_string.substring(name_start, name_end).trim();
gs.log(name + ' Activity ' + wfhGR.activity_index + ' is a turnstile.', script_name);
turnstile_count++;
}
}
gs.log ('Turnstile activities detected: ' + turnstile_count, script_name);
Ausgabe:
AHR: WF Activity NAME:Prevent infinite loops Activity 8 is a turnstile.
AHR: WF Activity NAME:Prevent infinite loops Activity 13 is a turnstile.
AHR: WF Activity NAME:Prevent infinite loops Activity 18 is a turnstile.
AHR: WF Activity NAME:Prevent infinite loops Activity 23 is a turnstile.
AHR: Turnstile activities detected: 4