Updating Cells with Trigger after Updating Another

I am currently working on a Updatable BAQ Grid using application studio. I have the BAQ that allows for updating the status of a job to be closed along with the date of close and the comments. I had a user reach out concerned of constantly having to put the closed date to today. Is there a way to make the closed date the current date when changing the status of closed to True?

I currently have a button for updating the data so the user can modify it without live changes avoiding mistakes as much as possible. Also the date has to be selected after selecting the closed since whatever bpm would normally set it to today doesnt trigger when using an updatable BAQ within an application studio grid.

You can in a to do it with an advanced bpm update instead of the stock business objects.

Oh makes sense. thank you very much.
Ill look for some documentation on this.

1 Like

You’d make a BPM on the Update method. You can probably use the widgets but I go code route. Sample of one I did for UD10 table:

using (var UD10Svc = Ice.Assemblies.ServiceRenderer.GetService<Ice.Contracts.UD10SvcContract>(Db, true))
{
    UpdExtUD10Tableset UD10ts = new UpdExtUD10Tableset();
     foreach (var ttResult in queryResultDataset.Results.Where(row => !String.IsNullOrEmpty(row.RowMod)).Select(row => row))
  {
    //update fields
    UD10.SetUDField<System.String>("SalesRep", ttResult.UD10_SalesRep_c);
    UD10.SetUDField<System.DateTime>("EnteredDate_c", DateTime.Now);
    
    UD10ts.UD10.Add(UD10); //Update table 
  }
}


Is there a how to on doing the code route or widgets I found the download for the .cs file but dont see where to upload it?

Epicor published “Kinetic BPM Cookbook” that’ll show the basics of creating BPMs and widgets.

1 Like

Since you already have a button on-click event, can you add a row-update at the end of this event which updates the Close date to “today”?

I believe the row-update expression would be: new Date('{Constant.Today}')

Actually… Constant.Today will only return the date.

If you want date and time, just use the expression: new Date()

1 Like

Appreciate that insight! This is my current event for the button click.

This is also the event it calls

I was thinking possibly using a condition for the dataset to check for jobs set to closed and that those closed jobs don’t already have a date and if they don’t then set the value to the job closed date to todays date but I don’t fully understand the execution model and if the conditions should be before triggering the update event or in between the dataview check and the rest-erp action or maybe there’s somewhere that I’m un aware of.

I am trying to iterate this and this is what I have but it seems my button is working on updating the original field (JobClosed) but the date isn’t working properly for some reason.

This is my row update for the ClosedDate

This is what i have for my working update so far.

Then I just do a grid refresh after calling the event. I was adding a dataview condition to this and then sending out to the rest erp wether or not the row has a True for closed or not but it seems to still not be updating properly.

Appreciate the help on this everyone!
I found a simpler then expected way to do this.

  • Create a Calculated field in the BAQ that always pulls the current date
    CAST(GETDATE() AS DATE)

  • Add this to the GRID but make it hidden since it has no purpose for the user in this case.

  • Go to Data rules and make a rule whenever a job is set to closed and the closed date wasn’t already populated set it to todays date.

  • For the SetColumnValue you will make it your calculated field that will always be todays date.




BONUS: If you want to clear out the date whenever a user makes a job no longer closed (or maybe mis clicks and hits the wrong job to close in this list)
You will want to make another Data Rule for that as well.

Since the button I posted previously in this thread shows how that works and grabs the current dataset whenever my user hits the “update” button it will take what the GRID has and push that up and now the job will properly be updated without needing any fancy BPM wizardry and leave room for the user to make mistakes in mis clicks or adjust the date to something else then todays date if they wish!