'GlobalLastError' returns nothing when a document fails from RunSQLCommand Task
I have the following on a GP Integration where I am trying to capture the error been thrown by eConnect but the GlobalLastError seem to return a null when I try to get retrieve the GlobalLastError from Script Task seem to be working here is my SQLCommand task.
Here is my Sql Command Task. Any ideas what am I missing?
Declare @BatchId varchar(21)
Declare @AssignedId varchar(21)
Declare @Message varchar(max)
SELECT @BatchId = ‘_BATCH_ID ‘
SELECT @AssignedId = ‘_ASSIGNED_ID ‘
select @BatchId = ltrim(rtrim(@BatchId))
select @AssignedId = ltrim(rtrim(@AssignedId))
select @Message = ‘GlobalLastError’
exec DPAssignment_UpdateMessage @BatchId, @AssignedId, @Message, NULL
Here is my Sql Command Task. Any ideas what am I missing?
Declare @BatchId varchar(21)
Declare @AssignedId varchar(21)
Declare @Message varchar(max)
SELECT @BatchId = ‘_BATCH_ID ‘
SELECT @AssignedId = ‘_ASSIGNED_ID ‘
select @BatchId = ltrim(rtrim(@BatchId))
select @AssignedId = ltrim(rtrim(@AssignedId))
select @Message = ‘GlobalLastError’
exec DPAssignment_UpdateMessage @BatchId, @AssignedId, @Message, NULL
Answers
Yassin,
On SmartConnect 2017 and later you will need to first reference the standard global variables before using them. I recommend creating a script task to run right before this task that referneces the ‘GlobalLastError’ variable.
GlobalLastError=GlobalLastError
return true
On SmartConnect 2017 and later you will need to first reference the standard global variables before using them. I recommend creating a script task to run right before this task that referneces the ‘GlobalLastError’ variable.
GlobalLastError=GlobalLastError
return true
Ethan, thanks for posting this solution, but … uhhh … why did this “feature” get added?