OnBeforeItemModifyEvent - Skip OnModify Trigger in table

IvonaKIvonaK Member Posts: 115
Hi to all,

I'm using NAV 2017 and I'm trying to create simple example with OnBeforeItemModifyEvent. I have create CU, where I have created my function

LOCAL [EventSubscriber] BeforeItemModify(VAR Rec : Record Item;VAR xRec : Record Item;RunTrigger : Boolean)

Rec."Unit Price":=Rec."Unit Price"+1;
RunTrigger:=FALSE;

But I don't want Trigger that it is OnModify in T: Item to be executed. How I can skip that???

Any advice,

Thanks a lot,

Answers

  • IvonaKIvonaK Member Posts: 115
    Yes but also if I change to be "VAR" doesn't still work.

    It works just if I add code in T: Item onModify Trigger . But I don't want to change the onModify Trigger or I should must?? (Is there some another solution to skip the OnModify Trigger without changing Table)

    OnModify()

    MyPublishers.BeforeItemModify(Rec,xRec,SkipL);
    IF SkipL=TRUE THEN EXIT;

    SetLastDateTimeModified;
    PlanningAssignment.ItemChange(Rec,xRec);
  • JuhlJuhl Member Posts: 724
    You are missing the concept.
    The OnModify is running and will not run again unless you call Modify(true).

    You use RunTrigger to test and prevent loops.
    IF NOT RunTrigger THEN
    EXIT
    Follow me on my blog juhl.blog
Sign In or Register to comment.