I created an updateable dashboard from a uBAQ that update a UD field (comments) on existing POs. The dashboard works as intended but after typing a comment, the user has to click save and then hit refresh to get the PO unnaproved, the comments updated and the PO reapproved . If the user doesnt hit refresh then POs remain unapproved. This lead to some frustation on the user part. To improve the user’s experience, I tried automating the refresh function using this thread: Dashboard Customization And dashboard refresh
I created a customization for this dashboard, in which I used Jose’s code and it works great in Pilot. Whenever I enter a comment and click “save”, the PO gets unapproved, the comment gets added to the UD field, the refresh function gets automatically called and the PO gets reapproved.
However, whenever I apply the same customization in the Live environment, It doesn’t work as intended. Whenever I enter a comment then click save, it goes straight to Refreshing the dashboard without unapproving the PO and adding my comments first…
Rather than a customization you can do the unapproval and reapprove behind the scenes so the user is not aware they happened. If I am doing my own update these there are in the same code block. If I am using Epicor’s update then you can do them preprocessing and post on update or just make sure the order field runs them before and after the update.
Thanks for this post. It’s so nice to discover that others have already struggled with what I am struggling with!
Another solution … Instead of Pre and Post directives that check if the PO is approved and then unapprove and reapprove, add one Base processing directive to do the update. The unapprove/reapprove is not necessary when you use the Db context instead of the business object because it bypasses business logic. Do this only for UD fields where you know there is no business logic needed.
In the uBAQ: In Update Processing > Advanced BPM configuration, add a Base processing directive on the Update method. Add a custom code widget with the following:
foreach (var row in queryResultDataset.Results.Where(o=> o.Updated()))
{ var po = Db.POHeader.First(o=> o.Company == CompanyID && o.PONum == row.POHeader_PONum);