Update not running when only callContextBpmData changed....?

Problem: I added a callContextBPM checkbox on the Sales Order -> Releases tab. If I check it and hit save, SalesOrder.Update doesn’t run (therefore my BPM doesn’t run). BUT, if I also change the value of a field on the releases tab and hit save, then the update runs, which then allows for my BPM to run.

Question: How can I get an update to run if the only thing changed is the callContext checkbox?

You can’t, callContext is not bound to the business logic they are independent. You have to “dirty” the orderRecord to fire Update. Simply setting the rowmod will do though.

What does “Simply setting the rowmod will do though” mean?

Set the RowMod on the Order is enough to trigger the BO.

Sorry to bug you, but I don’t know what you mean by setting the rowmod.

You have to get a hold of your dataview. Basically it’s the TT table that you see when you are doing your BPM. In a customization, it’s a data object. Use the Data Object explorer to find it. Then you will have to set the property in your customization.

2 Likes

Thanks. I found the screen that you reference via the Customization screen -> Tools -> Object Explorer -> Data Objects. My screen looks the same as yours.

What am I trying to do with this screen? All I’m trying to do is have a user click a checkbox, click save, then have a BPM run. Do I need to write some sort of custom C# code in this object explorer to make that happen?

Confused.

That gives you the data that you need to be able to change the rowmod to “U” so the BPM sees the row as changed.

Before we get too far, can you explain a little more what you are trying to do? Does your check box need to keep doing something more often than once? Or when something is changed? It might be easier to add a UD field and bind your checkbox to that. That way, if they check it, it stays checked (because it’s stored in the database) and it will make your BPM run when you change it. If you really need to run it again, unchecking, then checking it again, would do that.

But I don’t know your use case so I don’t know if that will work for you.

1 Like

If you are using the checkbox attached to call context, what they are saying is you have to have a change on the record for Update to fire. The call context is not part of the record so simply changing that hitting save does nothing. You’ll need to make a dirty row on a record (RowMod = “U”)

Probably an easier solution is to add a UD field (boolean) to your record type (i dont know if it’s head or dtl, etc) and use that. Problem solved all around.

And like @Banderson says, intention matters. Whatcha doin?

1 Like

Thanks Chris.

All I’m trying to do is have a way to fire a Bartender label print job. In the past I created a checkbox as a UD field. If the UD field was checked, I created the Bartender data and sent the print job, then cleared the checkbox.

At one point during the testing I was told that creating a UD field for this was a waste and that I should use callContext… That makes sense to me (since I’m not storing any data in the UD field), but I’m lost on getting this callContext technique working.

Maybe I’ll just go the UD field route and regenerate the model (this does seem like the wrong way to do what I’m trying to do though)…

if you dont want to make a UD field. You can probably do AfterFieldChange against CallContext dataview

afterfieldchange  (pseudo code)
{
case "CheckBox01":
var edv = oTrans.Factory("MyEdvForRecordTypeOfBO");  //i.e. JobHead, etc  - it must exist- see obj explorer
if(edv != null)
 {
  if(edv.Row >= 0)
   {
    edv.dataView[edv.Row]["RowMod"] = "U";
   }
  }
break;
}
4 Likes

Well, I don’t mind the UD field route. I’m just trying to make customizations as upgradable as possible. If I can stick with Epicor’s tools as much as possible without creating a faux UD field, or without adding manually typed code, I’d prefer that route.

I’ll try out your case statement. Thanks.

Understood, good logic. I think in this case a field called PrintTag_c wouldnt necessarily be an out of the way field. It’s reusable. As a personal preference, unless I had no other UD fields on any tables, I’d stick with the UD field as opposed to using the form code.

Also, take note that most likely since the record will be flagged as dirty, it’s gonna gripe for you to save it.

Jose… I’d like to try doing this. Do you have an example around on how I can set the RowMod on Order when my checkbox is clicked?

I’m guessing this is some C# code that I add into the Object Explorer like the screen shot in this thread?

Thanks.

@Chris_Conn’s post is the code that you will need to do that.

1 Like