Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested answer

Event Subscriber Trigger - When an Interaction is created

(0) ShareShare
ReportReport
Posted on by 10

Hi Forum,

I've got a requirement in Business Central where, when an interaction is created - a prompt needs to appear to ask the user if they want to create a Task (to-do).

The event that I can see is:

[EventSubscriber(ObjectType::Page, Page::"Create Interaction", 'OnQueryClosePageEvent', '', true, true)]

Does anybody know how to subscribe to this event only if the page is closed with an "OK", and the interaction is created successfully.    This trigger is being called with the "cancel" button as well.

Best regards,

Andy

  • Suggested answer
    Nitin Verma Profile Picture
    21,569 Moderator on at
    RE: Event Subscriber Trigger - When an Interaction is created

    Your are welcome. good to know it helps you.

  • Suggested answer
    Andrew Lees Profile Picture
    10 on at
    RE: Event Subscriber Trigger - When an Interaction is created

    Worked a treat, thank you for your help Nitin.

  • Suggested answer
    Nitin Verma Profile Picture
    21,569 Moderator on at
    RE: Event Subscriber Trigger - When an Interaction is created

    Please use below with updated one.

    if (CloseAction = CloseAction::LookupOK) THEN

               Message('YOUR ACTION GOES HERE');

           if (CloseAction = CloseAction::LookupCancel) THEN

               Message('YOUR ACTION GOES Cancel HERE');

  • Andrew Lees Profile Picture
    10 on at
    RE: Event Subscriber Trigger - When an Interaction is created

    pastedimage1663338158182v1.png

  • Andrew Lees Profile Picture
    10 on at
    RE: Event Subscriber Trigger - When an Interaction is created

    Its just a slight variation of yours to test the two actions.

  • Andrew Lees Profile Picture
    10 on at
    RE: Event Subscriber Trigger - When an Interaction is created

    pageextension 50126 CreateIntExt extends "Create Interaction"

    {

       trigger OnQueryClosePage(CloseAction: Action): Boolean

       begin

           if (CloseAction = CloseAction::OK) THEN

               Message('YOUR OK ACTION GOES HERE');

           if (CloseAction = CloseAction::Cancel) THEN

               Message('YOUR CLOSE ACTION GOES HERE');

       end;

    }

  • Suggested answer
    Nitin Verma Profile Picture
    21,569 Moderator on at
    RE: Event Subscriber Trigger - When an Interaction is created

    Show me your code. why this is not fire, it does not correspondence what the actual table is

  • Andrew Lees Profile Picture
    10 on at
    RE: Event Subscriber Trigger - When an Interaction is created

    Thanks Nitin,

    Excellent suggestion and I've just tried this - but the CloseAction condition didn't fire.  The only thing I can think of is that this page is called using funky temp tables.

    Andy

  • Andrew Lees Profile Picture
    10 on at
    RE: Event Subscriber Trigger - When an Interaction is created

    Thanks Amit, I did consider using the table.insert.  But my worries were that this only needs to be called from a user created interaction and that if I put the subscription requirement at this point, all the system created interactions would go through this code as well.

    Andy

  • Suggested answer
    Nitin Verma Profile Picture
    21,569 Moderator on at
    RE: Event Subscriber Trigger - When an Interaction is created

    Hi,

    Instead the event you can try Page Extension like below

    pageextension 50100 "Create Intc" extends "Create Interaction"
    {
        trigger OnQueryClosePage(CloseAction: Action): Boolean
        begin
            if (CloseAction = CloseAction::OK) THEN
                Message('YOUR ACTION GOES HERE');
            if (CloseAction = CloseAction::Cancel) THEN
                Message('YOUR ACTION GOES HERE');

        end;
    }

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,655

#2
Mansi Soni Profile Picture

Mansi Soni 1,574

#3
YUN ZHU Profile Picture

YUN ZHU 1,453 Super User 2025 Season 1

Featured topics

Product updates

Dynamics 365 release plans