Change Resource Group ID for Open Jobs

I ask myself this question everyday. :crazy_face:

In this particular case, I think it was a holdover from when I tried to create a dashboard with 2 UBAQs. More than one UBAQ in a Dashboard?
I was working on that project just before I started this one, so I began the same way. Creating a blank DB (dashboard) with empty tracker view to contain everything.

After considering the ‘why’, I went back and created a new dashboard based on my uBAQ. The new DB contains a native grid view that is a summary of my uBAQ. The DB also contains an empty tracker view, so I have a place to drop my textbox (to gather the new ResGrpID), and a button to execute the custom action.

I made both the grid summary and the tracker view ‘updatabale’, and I added the action to the action button list in each.

When I run the DB, first I am prompted to fill in the parameter that is required for the uBAQ to run. After I select the Old Resource Group ID from the dropdown list, the uBAQ populates the grid summary with the few jobs/ops that I want to update.

Now I just need my custom action to run the way it does from the BAQ designer. I have tried both my epiButton, and the custom action button on the action menu. Both seem to execute the custom action because my message boxes appear. The ttResults table also seems to be populated, as I can see the values in my message boxes. However, as the action reaches the end, no records are being updated.

I have made a few edits to my customization code.

private void epiButtonC2_Click(object sender, System.EventArgs args)
	{
		// ** Place Event Handling Code Here **
		// Make sure New ID text field is populated
		if (String.IsNullOrEmpty(epiTextBoxC2.Text) == true)
		{
			 MessageBox.Show("Please enter a new Resource Group ID.");
			 return;
		}

		// set callcontextbpmdata fields to textbox values
		EpiDataView edvCallContextBpmData = ((EpiDataView)(this.oTrans.EpiDataViews["CallContextBpmData"]));
		System.Data.DataRow edvCallContextBpmDataRow = edvCallContextBpmData.CurrentDataRow;
		edvCallContextBpmDataRow["ShortChar01"] = epiTextBoxC2.Text;

		// Run custom code to change resource group ID and desc 
		var edv = oTrans.Factory("V_ChangeOpenJobResGrpIDs_1View");
		BAQRunCustomAction(edv, "ChangeResGrpID");		
	}
	
private void BAQRunCustomAction(EpiDataView iEdv, string iActionID) //unchanged
{
    BAQDataView BAQView = (BAQDataView)iEdv;
    Assembly assembly = Assembly.LoadFrom("Ice.Lib.EpiClientLib.dll");
    Type t = assembly.GetType("Ice.Lib.Framework.BAQUpdater");
    BindingFlags bf = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy;
    MethodInfo mi = t.GetMethod("BAQRunCustomAction", bf);
    object[] param = new object[] { BAQView, iActionID};
    mi.Invoke("Ice.Lib.Framework.BAQUpdater", param);
}

For what its worth, I have attached the dashboard definition, along with the uBAQ. I also attached the customization for the dashboard. Is this enough to get this setup on your end? I will be happy to post all of this again once it works as expected.

ChangeResGrpID_DashTest1.dbd (244.9 KB)
App.ChangeResGrpIDs2.MainController_Customization_Custom1_CustomExport.xml (38.3 KB)

1 Like

I did it!!! Thanks to all of you that helped get me this far. Only 120 posts in! :slight_smile:
The only change I made was to go back to the BAQ and change :

!ttResults.UnChanged()
//to
ttResults.UnChanged()

Full post coming soon with updated attachments.
YAY!!!

It was a long road, but you all got me there!

The goal was to create a form that would show the user all open jobs and operations that utilize a specific Resource Group ID. When you first run the dashboard you will be prompted for the old resource group ID. This generates the list of jobs/ops to update.

Using the customization for the dashboard form, you can enter the new resource group ID and click the button to execute the custom action inside the BAQ.

This custom action doesn’t use epimagical methods, so take that into account when/if you try this yourself. If you find any major issues, please let me know!

ChangeResGrpID_DashWorking.dbd (244.6 KB)
App.ChangeResGrpIDs2.MainController_Customization_Custom1_CustomExport_Working.xml (37.0 KB)

New topic coming soon, so stay tuned as I now work this same process for the Part table side!

Although I am marking this post as the solution, I really would never have gotten here without the help of some of this forums best users:
@Banderson, @josecgomez, @knash, and @gpayne. You all are my heroes!
:heart:

3 Likes