Set Default Update Failure Action

Hello,

I'm really struggling with this.

How can I set the default update Failure action?


Dim nErrs1 As Integer
Dim DefaultFailure As Integer
Dim markId1 As Session.UndoMarkId

markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Expression")
Dim Accept As NXOpen.Update.FailureOption = 5

DefaultFailure = SetDefaultUpdateFailureAction(Accept)
nErrs1 = theSession.UpdateManager.DoUpdate(markId1)

This doesn't work, really need some help
Thanks


Option Strict Off
Imports System
Imports NXOpen

Module Module1

Sub Main()

Dim theSession As Session = Session.GetSession()
If IsNothing(theSession.Parts.Work) Then
'active part required
Return
End If

Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()

Const undoMarkName As String = "set update failure action"
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)

Dim oldUpdateFailureAction As Update.FailureOption
oldUpdateFailureAction = theSession.UpdateManager.GetDefaultUpdateFailureAction()

Try
theSession.UpdateManager.SetDefaultUpdateFailureAction(Update.FailureOption.AcceptAll)

Catch ex As NXException
theSession.UndoToMark(markId1, undoMarkName)
MsgBox(ex.Message)

Finally

End Try

lw.WriteLine("the default update failure action was: " & oldUpdateFailureAction.ToString)
lw.WriteLine("it has been changed to: " & theSession.UpdateManager.GetDefaultUpdateFailureAction.ToString)

lw.Close()

End Sub

End Module

Got it, Thanks.

I needed to call the SetDefaultUpdateFailureAction using theSession.UpdateManager.SetDefaultUpdateFailureAction()

this is what I did and it work.

Dim Accept As NXOpen.Update.FailureOption = 5
theSession.UpdateManager.SetDefaultUpdateFailureAction(Accept)

Cheers