Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 7915

How to execute a script in SBO_SP_PostTransactionNotice

$
0
0

Dear all,

 

I want to use the SBO_SP_PostTransactionNotice to run a query after an AR Invoice is added and have the results exported to an XML file.

 

Below is the query I have used in the stored procedure.

 

IF @object_type = '13' AND @transaction_type IN ('A','U')
BEGIN
DECLARE @FileName varchar(50),
@bcpCommand varchar(2000)
SET @FileName = REPLACE('C:\Test\AR_INVOICE_'+CONVERT(char(8),GETDATE(),1)+'.xml','/','-')
SET @bcpCommand = 'bcp "select CardCode, CardName, DocDate, DocNum, DocTotal from SBODemoGB.dbo.OINV WHERE DocEntry = @list_of_cols_val_tab_del" queryout "'
SET @bcpCommand = @bcpCommand + @FileName + '" -T -c'
EXEC master..xp_cmdshell @bcpCommand
END

 

But when I add the AR Invoice, this doesn't seem to run. I know the query works cause if I select an existing DocEntry number, I can export the file manually. But I would like this to run after every invoice is added.

 

Your help will be greatly appreciated.

 

Kind Regards,

 

Brian K. Maingi


Viewing all articles
Browse latest Browse all 7915


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>