How do I trigger an event only after a new sales order line is added?

I’m trying to trigger an event that slides out the Alternate Parts page after a new order line is added where the part number meets a couple of conditions.

I can get it to do what I want (currently triggering after MasterUpdate event), but it triggers every time there’s an update to the line. I only want it to trigger after a new line has been added, but by that point I can’t use a OrderDtl.RowMod = “A” condition, because the RowMod for all lines = “”.

Through a couple of BPMs I was able to get the method that is called when clicking the Complement icon to fire after a new line is created, except I couldn’t see where there was a way for that to result in the page slide out action.

Instead of events perhaps a BPM with a BPM data form maybe?

I would do this with an trigger based on when the PartNum changes.

Even if you add line and save it… but then say oops, I meant THIS part… you would want it to fire again, right?

So, I would say Datatable > Column Changed > OrderDtl.PartNum

1 Like

Yeah, that’s what I have in my BPMs, asking the user if they want to add complement parts. That all works great, except I don’t get the page slide out. And that makes sense to me, since the page is part of the SO application and not something–that I’m aware of–that I can interact with from the BPM.

1 Like

I’ll give that a try, as it is definitely a good idea to do it when the part is changed to one that fits my criteria. I was targeting after the line was added, though, because the Complements process also adds new lines and I assumed that triggering another event before the save happened would interfere with the original line add.

P.S. Happy to have the brain trust (@Randy & you) back with me for another challenge.

2 Likes

Yeah, I see what you’re saying there… :thinking:

Dylan Sprouse GIF by BuzzFeed

2 Likes

If I save a line, the last event that fires is ClearUpdateLock. Can you potentially run yours after that?

I’m assuming your condition is if the part has compliments… you want the Compliments panel to slide out automatically. (so you don’t have to worry about your user seeing the tiny shopping cart icon)?

1 Like

Ok, so that worked, though I had to create a new event for after SellingQty change, since new lines have a 0 quantity after entering the part and you have to have a quantity to open the complements page (because it calculates quantity per complement). Despite the user not clicking Save, it does add the new line, plus any the user chooses to add from the Complements function.

Now that I know that works, I’ll probably have to pivot to change of other fields, because we require things like Sales Category and Project ID be filled out on new lines.

I’m still interested to see if there’s a way to control it via added lines, but I may be able to make it work without.

1 Like

I think that will give me the same result whether the line is new or updated.

Yes, exactly. Conditions are has complements and another boolen Part UD field is true.

Oh, man! I thought I had it figured out. Changed my custom even trigger to be Before MasterUpdate event and updated my conditions to include checking for RowMod = “A”. That resulted in the slide out when I clicked save (i.e. getting it only after entering all I need to enter for a new line). Except it didn’t save the line I was adding and only added the complement lines.

2 Likes

I can add a data-commit widget prior to my event-next call and that saves the line that I’m trying to add. However, it adds it with Line = 0. But that’s not actually a saved line; once I navigate away from the sales order it goes away.

I’ve tried different things like putting an Update event-next after my data-commit, but so far nothing has worked at saving the record and giving it the correct Line #. (And, obviously, if I call the MasterUpdate process again it goes into an infinite loop.)

Be careful using data commit. It doesn’t do anything server side and instead tells the app that the data view is no longer in a changed state. Therefore not picked up when the update event is called as it is no longer a modified row.

One thought could you add a pre processing BPM to the master update to set a call context bpm data field to a value if it has an added row. Then in your after master update event in the app check that call context field and action as required? Resetting the call context as needed.

2 Likes

Yeah, I was noticing that. Didn’t really like this approach, so happy to discard it.


Ok, I had this thought, too, because I am already updating BPM context fields with data in a pre-processing BPM that I needed in the post-processing one when I was trying to go the BPM route. I just wasn’t sure how to then use that information in my custom event condition. Do you know? Would it be something like
"{callContextBpmData.ShortChar01}" == "A" ?

Not at a pc to check case of the data view but yes syntax looks correct for a condition in an event.

1 Like

That worked!

People Clap GIF

4 Likes