Using Panatrack Flex Fields within eConnect
When PanatrackerGP submits eConnect transactions, we pass along our flex fields in the event they can be used to update custom data within your GP system. This stored procedure provides a function that can be used to easily pull out a named flex field for use in your procedures.
- /* This is a helper function to assist in intercepting eConnect messages triggered from the Panatracker system.
- * For some transactions, Panatracker loads an additional field in the eConnect message with structured data that
- * can be used to retrieve information that is collected by Panatracker, but not necessarily used by Dynamics.
- * This function would typically be called from a eConnect pre or post trigger to retrieve the special data.
- *
- * EXAMPLE USAGE: Panatrack_ParseData(@I_vUSRDEFND5, 'ReferenceField1') --Will retrieve the data associated with the "ReferenceField1" field.
- */
-
- IF EXISTS (SELECT * FROM sysobjects WHERE type = 'FN' AND name = 'Panatrack_ParseData')
- BEGIN
- DROP FUNCTION Panatrack_ParseData
- END
- GO
-
- CREATE FUNCTION Panatrack_ParseData
- (
- @Input VARCHAR(8000),
- @TagName VARCHAR(30)
- )
- RETURNS VARCHAR(8000)
- AS BEGIN
-
- DECLARE @dataStartPos INT
- DECLARE @dataEndPos INT
- DECLARE @dataLength INT
- DECLARE @result VARCHAR(1000)
- DECLARE @startTag VARCHAR(30)
- DECLARE @endTag VARCHAR(30)
-
- SET @startTag = '[' + @TagName + ']'
- SET @endTag = '[/' + @TagName + ']'
- SET @dataStartPos = CHARINDEX(@startTag, @Input)
- SET @dataLength = CHARINDEX(@endTag, @Input) - (@dataStartPos + LEN(@startTag))
- IF @dataStartPos = 0
- SET @result = ''
- ELSE
- BEGIN
- SET @result = SUBSTRING(@Input, (@dataStartPos + LEN(@startTag)), @dataLength)
- END
-
- RETURN @result
- END
- GO
-
- GRANT EXECUTE ON Panatrack_ParseData TO DYNGRP
- GO