Wednesday, October 1, 2008

Why does my custom PostProc or Action procedures fail after updating my Docbase

If after your upgrade to eContent Server 4.2.6f or higher, your attached lifecycle or promote operations fail and see your dm_bp_transition log files contain single line entries such as the one below, you should remove any Print #2 statements from your custom Action or PostProc procedure code.

Sample Error:
[ErrorCode] 1700 [ServerError] Illegal Procedure Call 'Action'. Dmbasic error: 52


Server patch version 4.2.6f made changes to the dm_bp_transition.ebs file so log files are ONLY created when there is an error. This is to address the large number of dm_bp_transition log files generated on the server (bug 42336). Any "Print #2," statements in you custom procedures that use to print to the dm_bp_transition log file, will now cause the procedure to fail since the file is only opened when an error condition occurs.

If you want to print to a custom log file you should open your own log file for output in your custom code and number it something other than #2. For example, in a custom PostProc procedure you could do the following:

=====================================================
Public Function PostProc(ByVal SessionID As String, _
ByVal ObjectId As String, _
ByVal UserName As String, _
ByVal TargetState As String, _
ByRef ErrorStack As String) As Boolean

Dim rci as integer
Dim ret as Boolean
Dim OutFile as String

On Error GoTo PostProc_Error

PostProc = False

OutFile = "my_debug_" & SessionID & ".txt"
ErrorStack = "Opening debug file " & OutFile & "for output:"

Open OutFile For Output As #4
Print #4, now() & " In PostProc Procedure..."

......

PostProc = True

Print #4, "PostProc Procedure Successful"
Close #4

Exit Function

PostProc_Error:

ErrorStack = "PostProcess Procedure Failed: " & ErrorStack
Print #4, ErrorStack
Close #4

End Function

=====================================================

The rest of your processing code would also contain any additional debug Print #4 statements.

This debug file will be written to the %DM_HOME%\bin directory on Windows or $DM_HOME/bin directory on Unix, of the server machine.

No comments: