I’m trying to do a simple thing (as I thought)…
I created two custom fields: OrderHed.QuoteImported_c and OrderHed.QuoteImportedLines_c (both Boolean).
It does not work.
The value of the two custom fields remain false.
On the screen it changes the values from false to true, but if I refresh the view the fields turn false again.
I can’t understand why it does not work, it seems an easy BPM to me…
I’ve never had much luck with the Update methods. UpdateExt works for me, but it requires a different dataset type that you would need to populate instead of using the GetByID ds.
You probably can use the update method, you just need to mark the row as updated.
I didn’t a way to set this using a widget, so had to use a one liner in C# to do it:
JobDataSet.JobHead[0].RowMod = “U”;
If you’ve set the fields but they are being committed to the database, it’s probably because Epicor doesn’t know that they are changed (or dirty) rows. This single line will tell it so, and then normal processing will handle it. You do need to change the above to match your dataset.
When calling an update method, you have to set the rowmod to “U”. I think this is possible in the Update Table by Query, but a line of code is “easier”. Not sure why the SetField widget isn’t able to set that field…
Curious, what is the use case / business need for this? Seems like a strange thing to do; the GetByID method gets called all the time. May be missing something here, but won’t all your OrderHed records in the system end up having those 2 UD fields set to true (if the code worked)? I suspect there is a better way to accomplish the root requirement…
If it needs to be triggered one time for every order, the next question is at what point during the order do you need it triggered? Before the Order is saved for the first time, before any lines are added? After all lines are added? Before Shipment? Before Invoicing?
Sorry for the delay.
I need it to be triggered the first time the order is opened, case it’s created from quote and all the info are there except for my custom fields
I would offer that using the first GetByID is unreliable because the user would have to re-open an order or click the refresh button. Additionally, you have to track if the code has already run once.
It sounds like you need the logic to run once per Order. Most companies use either Ready To Process or Ready To Fulfill checkboxes you trigger the event. You will need to have these default to “false” in Company Configuration though.