Trigger to copy user defined fields from a POP Requisition to a PO Line

This is a trigger that that will copy the two user defined fields from a POP requisition to a POP Purchase Order. The client was using that to track Job and Task info.

If you are able to use it, leave us a comment below?

 

IF OBJECT_ID ('dbo.ddt_POP10110_INS','TR') IS NOT NULL
   DROP TRIGGER dbo.ddt_POP10110_INS 
GO
 
   
 
CREATE TRIGGER dbo.ddt_POP10110_INS 
    ON POP10110
    FOR INSERT, update
 
AS
    
if ((select TRIGGER_NESTLEVEL())) > 1 begin
    return
end
 
update pop10110 set
        JOBNUMBR = isnull(rl.USERDEF1,''),
        COSTCODE = isnull(rl.USERDEF2,'')
    from INSERTED ins
        join pop10110 pl on pl.DEX_ROW_ID = ins.DEX_ROW_ID
        join sop60100 s on s.PONUMBER = ins.ponumber and s.ord = ins.ORD
        left join pop10210 rl on rl.POPRequisitionNumber = s.SOPNUMBE
    where pl.JOBNUMBR <> isnull(rl.USERDEF1,'')
 
  
 
GO

 

 


RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences