Prompt for Save when changes made in UDashboard when Refresh Tool Clicked

Try to use the before toolclick event, look for a refresh button press and then evaluate if there is a changed row in the data set. If there is throw the native save dialog.

EpiString.DialogInfo di = EpiString.GetDialogInfo("UpdateOnFormClose");
var res = EpiCheckMessageBox.Show(di.Message, di.Title, di.Buttons);
if(res.Result == DialogResult.Yes)
{
    // SAVE CODE
}

Thanks…

And… wonder if you know how/if possible to check for dirty row(s) in the epidataview used by updateable dashboard?

Loop the dataview rows and look for rowmod = P

Hi Joshua,

having trouble figuring out the Code for this specifically. Would you be able to provide an example. :slight_smile:

Code to loop a dataview. Just add a condition looking for rowmod value vs setting a value like he is in his example.

Thinking this thread that might help too…

Hmmmm… just noticed “before” and “after” toolclick events don’t seem to be working for UBAQ customizations.
The toolclick event does fire though.
TBD if that is just the way it is, or maybe a version thing.

And… you might also be interested in this Knowledge Base article on the EpicCare stie:
https://epicorcs.service-now.com/epiccare/?id=epiccare_kb_article&sys_id=116f85931be308188b19fdd51a4bcbe0

“Updateable BAQs Dataset when using GetList, RunCustomAction and Update methods - KB0091912”

So… within a form customization for UBAQ

  • appears RowMod “P” doesn’t show up until the ttResults… downstream, BPM?
  • at least that is what it looked like on a test system - running version 10.1.6

Admittedly I havent read the whole thread here, but if I am picking up the context, I have found that if you want perform actions against ALL rows in a UBAQ you need ACTIONS as Update will only work on modified rows. You can however use an action to modify all rows in a UBAQ programmatically.

Specific to the OP, instead of before tool click, cant you do a BeforeAdapter method?

Thanks, sounded like a good idea, but…
when I looked at the FormEvent Wizard - BeforeAdapterMethod the Adapters dropdown was blank.

  • on a UBAQ form customization,

This one just caught my interest… SheaM made the original post, not sure still needs it.

I keep poking around when I get a minute… just because I haven’t really looked at UBAQ form customizations too much before.
Starting to realize the differences now, kind of making sense why.

I wonder if you can code your own before adapter method. As long as you can get ahold of the DynamicQuery adapter in the form you should be able to. Also, this is a deployed Dash right?

Thanks for all of the assistance guys!

Like Bruce has previously said in his posts, a lot of the suggestions haven’t panned out due to some Epicor bugs/issues related to the UBAQ.

I have actually managed to ALMOST completely solve my original problem through creating a UD checkbox field that is toggled to TRUE through a Value Change Row Rule.

I then have code on a Tool Click Event that will query each Row for the TRUE fields and Prompt a YES/NO message box that will save when YES is selected.

Then in the Background I have a Data Directive that sets the UD field to False every time there is an updated row in that table.

It’s a little clunky but I had a deadline and it seems to be doing the trick.

The only problem now is the code I have to check each Row for a True checkbox is using a foreach statement which is then showing a save prompt for EVERY row that has been changed.

Currently working on modifying that to a Count if I can, Count every True and if the Count is greater than 0 then show the save prompt

Yes…

Instead of:

foreach()
{
 if(true) MessageBox
}

You should be able to do something like this in you ToolClick

bool hasChange = false;
foreach()
{
 if(true) 
{
  hasChange = true;
  break;
}
}

 if(hasChange) MessageBox

There are more effecient ways to do it without a loop, but this is quickest from where it seems you are now

Thanks so much Chris! I really appreciate you taking the time to spell it out for me as I am a C# noob. Slowly getting better though!

This looks like it’s exactly what I am looking for and I will let you guys know how it goes when I implement it. :slight_smile:

1 Like

Sadly this code doesn’t seem to be working in my Dashboard. Wondering if it is another side effect of being a UBAQ?

Looks like it just isn’t recognizing the variable as the MessageBox pops up everytime.

what is your true condition?

Some Extra Reading:

This is what I’ve got right now, I took my previous code which was working, and slotted it into the format you provided. The messagebox at the end was just for testing purposes, instead of it prompting to save every time I tested it.

	private void baseToolbarsManager_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs args)
{	EpiUltraGrid myGrid; 		
		myGrid = (EpiUltraGrid)csm.GetNativeControlReference("5925c581-5da3-4aee-8fc1-66ea887789d1");
		
	if (args.Tool.Key == "RefreshTool")
	{
		bool hasChange = false;
		foreach(Infragistics.Win.UltraWinGrid.UltraGridRow row in myGrid.Rows)
		{
		if  (Convert.ToBoolean(row.Cells["JobAsmbl1_Teardown_Edited_c"].Value).Equals(true));	
		{
			hasChange = true;
			break;	
		}
		
		if (hasChange);
		MessageBox.Show("Did it Work?"); 
			
		
		}
	}	

}

Do either this:


if (args.Tool.Key == "RefreshTool")
	{
		bool hasChange = false;
		foreach(Infragistics.Win.UltraWinGrid.UltraGridRow row in myGrid.Rows)
		{
		if  (Convert.ToBoolean(row.Cells["JobAsmbl1_Teardown_Edited_c"].Value).Equals(true));	
		{
			hasChange = true;
			break;	
		}
		
		
			
		
		}

                if (hasChange)
		MessageBox.Show("Did it Work?"); 
	}	

}

or do this:

if (args.Tool.Key == "RefreshTool")
	{
		bool hasChange = false;
		foreach(Infragistics.Win.UltraWinGrid.UltraGridRow row in myGrid.Rows)
		{
		if  (Convert.ToBoolean(row.Cells["JobAsmbl1_Teardown_Edited_c"].Value).Equals(true));	
		{
                        MessageBox.Show("Did it Work?"); 
			break;	
		}
				
		}

                
		
	}	

}

Also, notice the ;. it ends the statement, this means it doesnt evaluate to show the messagebox, it simply shows it every time