In my model-driven app, I have a form with a custom ribbon button that changes a value and saves the record. What I would like it to also do is move to the next record in the view list that the form was opened from. Does anyone know if this is possible?
Something like this would be ideal:
formContext.data.entity.save("saveandnext");
@cchannon - Thanks for the idea. I presented that as a possible solution to our stakeholders, and we may go with it. But their concern is it's 2 clicks instead of 1. This seems nitpicky to me, but they do a high volume of data entry.
MSFT OOB functionality to the rescue!
There is a new button in the ribbon (not sure when it got added, to be honest, I just noticed it this morning) and this button opens a Left side panel with the view you came from to this record, so if you have your users click this button, they will get a scrollable left list of their view and can easily just hit Save, then click the next row in the view. Screenshot below - Red circles the button, Green circles the new left list.
You could replace the grid you're coming from with a PCF that pops a modal form. That way, you never really leave the context of your grid. There are a lot of downsides though; you would need to build a grid that replaces enough of the OOB functionality, then you would need to replace all grids that need this capability with your PCF, then you would need your users to be OK with the fact that some grids behave one way and others behave differently... Not ideal, but possible.
I don't think that's possible. At least, there's no way that I'm aware that you can retrieve the table view you were on prior to loading the record.
The best you could do is a custom retrieve that filters to the next record based on some static filter criteria and your current record acting as a 'previous'. That would only work if you sort criteria was based on something like a date.
Alternatively, what about a ribbon button that acts on multiple records at the one time? We have a ribbon button that updates progress status of multiple selected records from the table view.
When you're within the context of the form where your custom ribbon button resides, that context has no knowledge of where it's come from (with exception to the save and close, but its D365 internally knowing what the previous record was)
There's 2 options that come to mind that could get you part of the way but you would have to use an editable grid and you would still have issues if the user has sorted or filtered the grid results and if the results spanned multiple pages.
1. On click of the record within the grid, register an event handler for the record select event, where you can then replace what happens when a user selects a record. From here you can then open up the form for the entity and pass custom parameters to the form which you can then read in custom JS on the form on in the custom ribbon button action. You could theoretically get all the record ids from the grid and pass them through to the form so you could theoretically work out which is the next record to open, or pass the id of view that the grid is using and execute that view via code to get the same results in code (but they both present more issues if you go down this route)
2. An alternative to the save and next: Register the same record select event handler as (1), but instead of navigating away from the main form where the grid resides, you can popup the record in a modal popup instead, so the user hasn't navigated away from the main form, and could just click on the next record in their view of the grid results once they've saved the current record
WarrenBelz
146,645
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,997
Most Valuable Professional