web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

SQL Trigger on SOP10100 Table not firing - See trigger below

(0) ShareShare
ReportReport
Posted on by 1,150

I am trying to write a trigger on SOP10100 table to insert into the Location field from the Location_Segment field from SVC00600 table. All seems OK however it won't fire. Any ideas greatly appreciated

USE [TEST]

GO

/****** Object:  Trigger [dbo].[SOP10100_LINK_SVC00600_AFTERINSERT]    Script Date: 07/23/2013 08:31:38 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

ALTER TRIGGER [dbo].[SOP10100_LINK_SVC00600_AFTERINSERT]

ON [dbo].[SOP10100]

FOR INSERT

AS

BEGIN

UPDATE SOP10100

SET SOP10100.LOCNCODE = SV.LOCATION_SEGMENT

FROM INSERTED

INNER JOIN SVC00600  SV ON sv.CONTNBR = INSERTED.REFRENCE

WHERE SOP10100.[CUSTNMBR] = INSERTED.[CUSTNMBR]

AND SOP10100.[DOCAMNT] = INSERTED.[DOCAMNT]

AND INSERTED.REFRENCE <> ''

END

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Shyam Nath Profile Picture
    505 on at

    The reason I can think of: If you write an INSERT trigger, it will fire the moment you tab out of Document No. field while entering a new sales transaction. So INSERTED.REFRENCE field will be blank and the update statement did not execute properly.

    Cheers,

    Shyam.

  • PGS Profile Picture
    1,150 on at

    Thank-you Shyam, I see your point and decided to run it off SOP10200 instead

    David

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
Dan Liebl Profile Picture

Dan Liebl 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans