Skip to content
+1-888-319-3663

COMMUNITY FORUM

'GlobalLastError' returns nothing when a document fails from RunSQLCommand Task

Yassin asked 3 years ago
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
Answers
Ethan Sorenson Staff answered 3 years ago
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
Tom Partridge replied 2 years ago

Ethan, thanks for posting this solution, but … uhhh … why did this “feature” get added?


If you would like to submit an answer or comment, please sign in to the eOne portal.