cancel
Showing results for 
Search instead for 
Did you mean: 

Before save event is not triggered in Custom BO from Task TI Embedded component

ravi_a3
Participant
0 Kudos

Hi Experts,

I have created EC in Task TI to capture the notes using standard EC (singlenoteshistory).

These notes will be stored in custom BO. Here, I m using a standard dependent object with the node as "TextCollection".

I am unable to find the events for the node, I could see the events for root only.

So, I have to write some logic whenever add notes using my EC. The thing is "Before Save" event is triggered for the first time when opening the EC tab. If I want to add new notes without moving on any tab, I will click the change button then type the notes then save. In this scenario, the event is not triggered.

I want to trigger the save before event when clicking task TI change button, please suggest to resolve this.

Thanks,
Ravi

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member183363
Active Contributor
0 Kudos

If the root-level BeforeSave doesn't trigger when changing the text then you might be out of luck I'm afraid. Changing a root-level field and then saving to trigger the BeforeSave is the only real sure-fire way of doing it so far as I know.

The notes will, of course, save even if the script file isn't triggered. However, are you sure that the script file isn't triggering when you update the notes and then click Save? Have you activated the parent BO?

former_member606838
Participant
0 Kudos

Hi ravi.a3,

You have the Mass Enable indicator on. I guess that's the reason unless your logic is designed for that particular option. I cannot decided unless I see the code. But my first impression is that it's the reason. Please share the before save code.

ravi_a3
Participant
0 Kudos

Hi Musa Alramadhan,

Thanks for your reply. PFB, for my code.

Also, I kept the break-point on the beginning of the execution line. but when do change in custom EC and click on save button, before save is not called except the first time.

Thanks,

Ravi

VVancalbergh
Contributor
0 Kudos

A couple of things:

  • The Before Save trigger only runs if you changed something.
  • This isn't the entire trigger. Something higher might have caused the code to exit prematurely.
  • If your code is mass-enabled your code needs to treat 'this' as a collection with (possibly) more than 1 item.

The simplest way to handle mass enabled is to make a loop:

foreach (var myObj in this)
{
  xxx
}

That avoids the .GetFirst() statements and makes your code work if 'this' ever contains >1 object (which doesn't happen often, but can in case of a Mass Data Run or if a button on a screen calls an action with multiple lines selected).