Solution to eConnect Requester SOP Transaction trigger not creating output records
eConnect uses a Document Requester system to allow database activity in GP to be tracked, say for the creation of sales orders. It also allows the database to be queried via the eConnect API, without any logging to output tables.
Steve Endow has written up here on his blog, 8 year old bug in eConnect Requester SOP Transaction trigger an issue. Essentially the eConnect_Out table was not receiving any records when new sales orders were created, even though the SO_Trans Insert trigger was enabled.
The issue boiled down to the auto-generated code for the trigger generated by the default requester that is “supplied with” eConnect, inappropriately making CUSTNMR a required conditional field on order record insert. Steve correctly identified that as the CUSTNMBR field is initially empty in the SQL table and is actually updated after the record is inserted. As the CUSTNMR is updated rather than inserted this is why the requester fails to insert a record in the output table. See his post for full details and a better explanation.
I’ve worked with eConnect requesters a for a long time and can offer a suggested way I would solve this issue.
eConnect provides a executable utility shown in the screenshot above, the Requester Setup Tool that allows administration of the provided output document types. I have the feeling that this utility did not exist when I started using eConnect (back many years ago), or perhaps I never noticed it, so I have always just gone right to table to change and create existing or new requesters. This puts me at an advantage for this issue as I know how requesters work.
The utility is actually merely manipulating rows in [dbo].[eConnect_Out_Setup] table. SQL triggers on this table do the clever task of creating other triggers against the relevant tables that we seek to monitor. Looking at the row for the SO_Trans record, we see the following in the setup record;
Note that CUSTNMBR has be defined by GP as a required by having CUSTNMBR in the REQUIRED1 field. This is why it is being set in the trigger as required and so why it fails to create the output record when a initial record is inserted into the database with no CUSTNMBR value.
To solve the problem we simply create a new output definition record that does not has a that "CUSTNMBR" valued in REQURIED1 the field. The design of eConnect is such that integrating applications can access the setup table directly to subscribe to what they need in GP.
To achieve this, script out the data from the original row setup row, give it a new alias name and remove the field in the REQUIRED1 value.
Insert this record into the [dbo].[eConnect_Out_Setup] table (in production the application can do this on install or start of the application). The insert causes a new trigger to be created against the sales table SOP10100, this time without that required field. Do a test, now creating a new sales order will correctly create a record in the output table.
Below is the row to insert using Sales_Transaction_All as the requester name and SO_Trans_All as the alias (change these names to something that won't be used by any other application in real production deployment:
INSERT [dbo].[eConnect_Out_Setup] (
The new requester row creates the associated insert trigger against SOP10100 as shown below.
The trigger contains the following SQL, note now no required field any more!
/****** Object: Trigger [dbo].[eConnect_Sales_Transaction_AllSOP10100_InsertTrigger] Script Date: 02/03/2016 15:11:01 ******/
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER OFF
CREATE TRIGGER [dbo].[eConnect_Sales_Transaction_AllSOP10100_InsertTrigger] ON [dbo].[SOP10100]
DECLARE @required CHAR(50)
DECLARE eConnect_Sales_Transaction_AllSOP10100_InsertTrigger CURSOR
SELECT convert(VARCHAR(50), SOPNUMBE, 121)
,convert(VARCHAR(50), SOPTYPE, 121)
FROM inserted a
SET NOCOUNT ON
WHILE (@@FETCH_STATUS <> - 1)
NOT EXISTS (
WHERE DOCTYPE = 'Sales_Transaction_All'
AND INDEX1 = @SOPNUMBE
AND INDEX2 = @SOPTYPE
SELECT @DRI = 0
SELECT @DRI = isnull(DEX_ROW_ID, 0)
WHERE SOPNUMBE = @SOPNUMBE
AND SOPTYPE = @SOPTYPE
IF (@DRI > 0)
FROM eConnect_Out b(UPDLOCK)
b.DOCTYPE = 'Sales_Transaction_All'
AND ACTION = 1
AND INDEX1 = @SOPNUMBE
AND INDEX2 = @SOPTYPE
INSERT INTO eConnect_Out (
The new requester type also now shows up in the setup tool as expected for future editing (might need to reconnect to refresh).
Finally here we have it, the output record in the output table,
Note that this record in the output table is created immediately that the order is created, but before it is saved. Beware acting on this until the integrating application can see the key fields of the order are complete, perhaps check the dexterity lock tables too, thus to ensure the editing is complete. Maybe this was the misguided reason that led the CUSTNMBR to be included as a required field originally?
In reality if it is merely a flag for created orders that is required, for the setup record, only SOPNUMBE and SOPTYPE are worth capturing as data fields, the rest are mostly blank anyway.
Also note that the user could click the [x] and close the order, and the SOPNUMBE will be returned to the stack and could be used again with a future order. The integrating application has to handle that too.
Although eConnect installs some example requester documents to get users going, additional requesters can be added to meet specific requirements. eConnect requesters are configurable and quite flexible, however this requires direct editing of the setup table.