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

Notifications

Announcements

No record found.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
mtabor Profile Picture

mtabor 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans