12-29-2021 03:40 PM
Does anyone have any sample code they can share to see how to trap errors during an automated dataload process? Currently, all I can see is that the dataload process executed and completed but it does not tell you if something happened in between. I'm having no luck capturing if an error was encountered during the import or validate steps.
01-03-2022 08:58 AM
I believe you lliterally need to capture the status:
Dim MyTimeDimAppInfo As TimeDimAppInfoEx = New timeDimAppInfoEx
Dim statusMsg As String = batchInfo.GetCompleteBatchStatusMessage(si, MyTimeDimAppInfo, True, True)
The statusMsg will be the placeholder for the, well, status messages, that you can sort thru, display via error log or send by email. Something like:
If statusMsg.IndexOf("Validate Intersections")...
01-03-2022 12:22 PM - edited 01-03-2022 01:33 PM
Here's an example that executes a direct connect import and captures the status. If the status of wfUC_Import contains an error, the code logs the message, sends out an e-mail, and exits the rule. If no error is found, it logs a successful completion and moves on to the next step.
Here's the actual code:
'Define the Workflow unit cluster 'Execute Data management load to process the workflow channels |
01-04-2022 03:43 PM
Thank you @Koemets and @Gidon_Albert for sharing your ideas. These helped a lot. I was able to figure out how to handle if the autoload process encountered an error by using the statement below:
Dim state = brapi.Workflow.Status.GetWorkflowStatus(si, si.WorkflowClusterPk, True)
If state.HasErrors = "True"
'Do Something
End If
01-05-2022 09:30 AM
Hi Jun,
Did you build this rule within Extensibility rule?
01-05-2022 09:41 AM
@Mustafa_A Yes.
01-05-2022 10:30 AM
Thanks!
I'm trying this out for curiosity. Did you set this BR as a sequence within your load data management?
Here is the code. Would appreciate some feedback/comment.
'Define the Workflow unit cluster
Dim wfClusterPk As WorkflowUnitClusterPk = BRApi.Workflow.General.GetWorkflowUnitClusterPk(si, "Mgmt Process Load.Import", "Actual", "2021M12")
Dim state = BRApi.Workflow.Status.Getworkflowstatus(si, wfClusterPk, False)
If state.HasErrors = "True" Then
'Connection to the mail server (Defined in Application Server setup)
Dim emailConnectionName As String = "OneStreamEmail"
'Email content (Subject & Body)
Dim subject As String = "Test Test Test "
Dim messageBody As String = "You've got error"
'Add email addresses
Dim toEmail As New List(Of String)
Dim userEmailAddress1 As String = "makbar@xyz.com"
toEmail.Add(userEmailAddress1)
'Send the message
BRApi.Utilities.SendMail(si, emailConnectionName, toEmail, subject, messageBody, Nothing)
Else Return Nothing
End If
01-05-2022 11:16 AM
I believe this would work. I would go ahead and create a DM job to test this. If you are not getting to the email component during your test, I'd throw out exceptions to see what's going on.
03-16-2022 05:36 PM
Hello,
can you please share with me the code used to automate the workflow (import,validate,load) ?
thank you
04-26-2022 06:18 PM
Hi Kevin,
Happy to share the code, but there is a limit to the number of characters a message can contain. Happy to share via e-mail. I'm at gidon.albert@morganfranklin.com .