Dear All, i need to Trigger a Data Directive BPM when the user click on a button in customization,
all i need is to know the code.
A data directive is triggered in a data save so change / save some data
What it sounds like you want to do is to create a FUNCTION (newer feature in Kinetic), and then call that function with the button. It is the only true way to trigger an action that is not based on saving a record, or calling a business method.
One “trick” is to burry your BPM code into another business object (such as the TIP.GetNew) and then do a get new record on the Tip table… then your BPM will fire.
One way to trigger the data directive WITHOUT really saving something is to set the RowMod = “U” and nothing else.
guys can i get sample code I’m bit lost here, thanks
nice!
After doing some tests, assigning “U” to the RowMod no longer works, the data directive does not fire. Hummm . Or maybe it only works in updatable dashboard…
Anyway, you could assign an unused field (or better a custom UD field) to force the data directive to fire (you could use a timestamp)
private void epiButtonC1_Click(object sender, System.EventArgs args)
{
var ud10View = oTrans.Factory("UD10");
ud10View.CurrentDataRow["Character01"] = DateTime.Now;
oTrans.Update();
}
You could set it back to blank in the data directive.
What i have seen others do is call an updatable BAQ that has a query like
SELECT TOP 1 from company and then create a base BPM on that to call a function.
There are multiple way to fire a bpm.
But I think we should use Epicor Function as much as we can for contexts expressed above.
Yes no doubt about the function part.
There’s a ton of code on the forum about how to fire a BAQ on a button click which is why I was suggesting the original poster could use that code and fire an updatable BAQ with a function attached to it.
As @timshuwy suggested there is no need to figure out a way to trigger bpm’s/ubaq’s any longer with these workarounds. Simply create a function and call it with a button click event (can be done in classic or Kinetic easily). There are plenty of examples on here
Can you show me one in classic, link a post? I was under the impression you couldn’t.
It’s right in the help Utah
using Ice.Lib.RestClient;
using Ice.Tablesets;
using Ice.Common;
var restClient = new RestClientBuilder()
.UseSession(this.oTrans.CoreSession)
.Build();
var calcShipByDateContent = new RestContent(new {needByDate = new DateTime(2021, 8, 1), custNum = 3});
var getByIdResponse = restClient.Function.Post("LibraryName", "FunctionName", calcShipByDateContent , published: true);
var functionResult = getByIdResponse .GetJsonResult();
But its much more detailed in the Help.
the problem is I’m choosing data from the grid I’m not selecting or getting by ID
so i need the code how we can get by id data and update it
Beautiful, where I was getting twisted was a post from you saying not to use rest calls to call BOs when you are in the application.
I will dig for the post… It won’t apply to calling a function because I don’t think a function can be called using BOs.
Here is what I was referring to, but it was me misunderstanding what you were talking about here, of course.
Thanks for sharing with me again that it’s in the help!