16. Processes
9 апреля 2020 г.
10:11
Process Orchestration
В начале процессе в PreScript Generating в конце скрипта не должно быть (), как в лабе
Заменяем кавычки на нормальные ""
У задания
Designer – Process Orchestration – Process Automation
CCC_Export Person to CSV
Выставил Activation Schedule в Deactivate, а был ССС_Export Person to CSV
Задание сохряняет результать выполнения скрипта на Job сервере
Создание группы AD
Процесс HandleObjectComponent - Insert

Передать UID созданной группы на следующий шаг процесса
Надо в шаге создания группы HandleObjectComponent в параметре ResultingKeyParam указать
Value = "UIDADSGroup"

На следующем шаге для параметра val_UID_ADSGroup
Присвоить значение
Value = "&OUT(UIDADSGroup)&"

Срабатывание процесса при создании запроса на портале
Manager
![Navigation IT Shop Info system IT Shop Request templates Req uests Service catalog Hierarch] by service categories Access Lifecycle Active Directorygroups Employee management Sa30Eble poll' napo,u• Singles Requestable service items Not available service items Predefined "E Custom defined Terms of use &asic configuration data Processirrg status Stardard reasons Employees Organizations • Business Roles Entitlements IT Shop x Service items (1) Recently used C6poc napong so scex C'•1CTeMax C6poc napong so scex cncTeMax Reset Central Password X Result list Tasks Favorites Toolbox AlignIayoLt Approval levels Add Approval steps Assignm ene Remove posibve Remove reroute Remove escalaton Copyworkfiow„ O App roval wo rkfiow overview Change master data Reset Central Password Approva I level Check Pers on Ordered equal Person Ins erted (CD - Calculated Decision) Approval level Security Admin (OR - Memb Approval level Call event (EK- Approvals to be made externally)](../media/16. Processes/media/image4.png)

Designer - Процесс
![Navigation Process Orchestration Processes Customized processes Custom processes AttestationCase Department DialogScheduIe person PersonHasTS&AccountDef PersonWa ntsOrg g] PersonWantsOrg Enable Employee in separate proc g] PersonWantsOrg Enable Temporary Disabled Empl( personWantsOrg Reset Central User g] PersonWantsOrg TemporaryDiszbIe Employee Reset AD Passwo rd UNSAccount8 Process automation Objects without processes Process components Object events Provisionirrg processoperations Getting Started One Identity Manager Schema O Getting Started Schema Editor Reset Central User Set new password L' "Ste Set Central p.rd Send mail with central password Send +rnsil hiving the centr.l to the Hed of prim—ry department Make positive decision for requ Events Process - Person WantsOrg Reset C... • Nake negative decision for requ Sort order Permissions Process Orchestration ResetCentraIP.VO](../media/16. Processes/media/image6.png)
Процесс отправки почты заявителю при согласовании процесса
"VI_ESS_PersonWantsOrg_Send Mail when Closed", connected it to the event "ORDERGRANTED"
values
Pre-Script каждого шага процесса генерируется на отдельной машине.
Тип данных, который позволяет передавать values - только string!
Поэтому, чтобы передать DateTime, например, надо сериализовать в строку и потом обратно десериализовать в DateTime при передаче переменной между шагами!
Вызвать ошибку в шаге процесса, чтобы пойти по пути Successor(Error)
We've a process to insert account to Target System. At the one of the step we executing script. If something goes wrong we are throwing an exception:
Public Function VRS_UNSAccountB_Insert(...) As Boolean
...
If retMessages.Length = 0 Then
Return True
Else
Throw New Exception(retMessages.ToString())
End If
End Function
How to pass this exception to "Notification on error" Message body?

* *
Configure your script or process to throw an exception with your string object:
Throw New ViException(strMessageForMail)
Then in the process notification on error tab in the Message part where you specify Value = "Something"
You can reference a special parameter called "[AdditionalMessage]" (must be wrapped in "'s) - this will contain whatever you put in the string for the exception.
SQLComponent - Exists - чтобы не возникала ошибка, когда нет объектов по условию Where
Надо указать в Error Handong - Split Processing
![Process step properties General Generation Error handling Extended Latency [min] Log mode Waitmode on error Splitprocessing Ignore errors Stop on error Log errors to journal](../media/16. Processes/media/image8.png)
Split processing
Process steps that are only required for branching the process are labeled
with this option. An example could be a process step that checks for the
existence of a directory. The next process step to be processed is either
the step on success or the step on error (without generating an error
message) depending on the return value.
Расчет согласующих в шаге согласования
Отвечает процедура SQL
QER_PITShopHelperFillAll
Вызов хранимой процедуры SQL
Dim f As ISqlFormatter = Connection.SqlFormatter
Value = f.StoredProcedure("vi_ReCalcPWOHelperPWO","'|CP|'", "'" & CStr(Connection.Variables("GenProcID")) & "'")
Process Monitoring
Сохранение объекта с указанием ProcID для поиска в истории.(см в Scripts)
ProcID можно использовать для идентификации и связи процессов между собой.
Если мы имеем 2 таблицы, процесс для первой делает изменения во второй, то при внесении изменений можно указать ProcID этого процесса, чтобы потом в DialogWatchOperation можно увидеть, какой процесс связан с этим изменением (DialogProcess)
Для самого процесса должна стоять галка ProcessHistory для сохранения в таблице DialogProcess. И для корня процесса - Process Information - Full process Tracking


Для того, чтобы видеть изменения по столбцу в DialogWatchOperation для поля должны стоять галки Log Changes и Log Changes when deleted

В дополнение по мониторингу процесса
Если мы запукаем скрипт и он порождает другие процессы, то эти процессы можно запускать с одним ProcessID
-
В процессе, в шаге запука скрипта указываем параметр: CStr(Connection.Variables("GenProcID")) - передача ProcID
-
В скрипте делаем параметр типа String - ProcID
-
Проверка на запущенный процесс с ProcID в очереди
For Index As Integer = 1 To 10
If Session.Source.Exists("JobQueue", String.Format("GenProcID = N'{0}' and JobChainName \<> N'CCC_SED_DeleteProduct'", ProcID)) Then
Threading.Thread.Sleep(60000)
End If
Next
- Запуск процессов с указанным ProcID
Using uow = Session.StartUnitOfWork(ProcID)
For Each colElement As IEntity In colSEDESet
dbESet = Connection.CreateSingle("Eset",colElement.GetValue("UID_ESet"))
crESetHasEntitlement = dbESet.GetCR("ESetHasEntitlement", "UID_Eset")
For Each colElement1 As IColElem In crESetHasEntitlement.Children
dbESetHasEntitlement1 = colElement1.Create() dbESetHasEntitlement = Session.Source.Get("ESetHasEntitlement", colElement1.GetValue("UID_ESetHasEntitlement"))
dbESetHasEntitlement.MarkForDeletion()
uow.Put(dbESetHasEntitlement)
Next
Next
uow.Commit()
Для некоторых таблиц не отрабатывают события Assign, Remove…
Включить в Designer поле isAssignmentWithEvent

Assign by event
Только для таблиц many-to-many
Сравнение дат
\$CCC_dtEmailSent:Date\$ > Date.Parse("12/30/1900",CultureInfo.InvariantCulture)
Условие выполнения процесса
Есть скрипт, который выполняется на одном из шагов и результат выполнения скрипта - строка пустая или нет
Нужно на следующем шаге, в зависимости от результата выполнения скрипта, выполнять шаг сравнения результата скрипта (CommandComponent - Compare)



Объяснение путей согласования в таблице QERWorkingStep
В QERWorkingStep это поля маршрутизации шага согласования.
PositiveSteps — куда идти при положительном результате шага. NegativeSteps — куда идти при отрицательном результате шага.
Практически это работает как “смещение по уровням” (jump) внутри UID_QERWorkingMethod: - 1 = следующий уровень - 2 = пропустить один и перейти через уровень - 5 = перейти на уровень +5 - 0 = не переходить дальше (обычно завершение ветки на этом результате)