# Debugging (Tracing) System Button **Category:** [Epicor ERP 10](https://www.epiusers.help/c/e10/5) **Created:** 2016-10-28 20:03 UTC **Views:** 1503 **Replies:** 16 **URL:** https://www.epiusers.help/t/debugging-tracing-system-button/36006 --- ## Post #1 by @Chris_Conn I am working on the Work Queue screen in the MES. I am attempting to automate the search for work based on Resource Group. Currently, you have to click the button "RESOURCE GROUP" which opens up a Resource Group search, when you select a record, it automatically closes the search (calls LoadUserResults), then performs WorkQueueAdapter.GetOpsInResourceGroup. I have created a button, and I manually call GetOpsInResourceGroup using the data I want - OK here, no problems. It goes like this: wq.GetOpsInResourceGroup(ResGrupID, EmpID, WhereWork, WherePart, 0, 1, out res,LaborType,out WorkRecs,ClearCache,Filter); oTrans.NotifyAll(); oTrans.Update(); No data appears. So I add oTrans.Refresh(); It appears that it runs GetOpsInResourceGroup again but with whatever PARAMS the system uses. I.E. - Since I didn't manually pick a resource, I get "No valid ResourceGroupID". Ultimately, how do I find out where the process is pulling it's PARAMS from, I assume they will be available to me, IF I can find them. Tracing showed me what methods are called, and what params are passed - but I cant find the damn things. --- ## Post #2 by @Chris_Conn If it helps, the MES screen is: DEGO1080 The button EPI binding is: WorkQueue.ResourceGroupButton The button GUID is: 36da63c1-8ce7-4f2c-9c5b-6de0d778b39b --- ## Post #3 by @josecgomez Try getting your resource ID and your resourceeGroupDescription and then do the following oTrans.GetByID(myResourceID,MyResourceDesc); Then it gets tricky you need to set ClearWorQueueCACHE to true but this is an internal private variable so you'll have ot use reflection... (do you know how to use reflection?) the variable name is ClearWorQueueCACHE and you want to set it to true, it is defined in the oTrans object Then you want to invoke another private function this time defined in WorkQueueEntry.WorkQUeueForm called setUpWorkQeueueRecordsPageInfo() again this needs to be invoked via reflection last you want to also invoke the private function OnAfterResrouceGroupSearch() also defined in oTrans If you don't know reflection i can put an example together but otherwise this should do it --- ## Post #4 by @Chris_Conn I know the purpose of reflection, but I have never used it. A basic example in Epicor would be Epic :smiley: --- ## Post #5 by @Chris_Conn Also, there is a parameter in WorkQueue.GetOpsInResourceGroup called ClearCache 0 is this different than what you are describing? --- ## Post #6 by @josecgomez I am not sure about that param... Note I can't test the below example so I am going to do my best to type without scrwing thing up! But I can't guarantee it, so if you have syntax issues let me know ```cs using System.Reflection; //Add public void mySelection(String resourceGroupID, String resourceGroupDesc) { var prop = oTrans.GetType().GetField("ClearWorQueueCACHE", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); prop.SetValue(oTrans, true); oTrans.GetByID(resourceGroupID,resourceGroupDesc); workQueueForm.GetType().GetMethod("setUpWorkQueueRecordsPageInfo",System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).Invoke(workQueueForm,null); oTrans.GetType().GetMethod("OnAfterResourceGroupSearch",System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).Invoke(oTrans,null); } ``` --- ## Post #7 by @Chris_Conn Meh - edit fail --- ## Post #8 by @josecgomez You have to decompile the epicor DLL's which I do for fun on my spare time ;-) jk --- ## Post #9 by @Chris_Conn Error: CS0103 - line 127 (291) - The name 's' does not exist in the current context --- ## Post #10 by @josecgomez LoL paste your code gonna need some context. Paste the line its erroring at.. actually I see it ```cs prop.SetValue(s, true); ``` should be ```cs prop.SetValue(oTrans, true); ``` --- ## Post #11 by @Chris_Conn Paste *MY* code? Haha, I've stole yours! :D public void mySelection(String resourceGroupID, String resourceGroupDesc) { var prop = oTrans.GetType().GetField("ClearWorQueueCACHE", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); prop.SetValue(s, true); //<----- OFFENDER, what is the s object supposed to represent? oTrans.GetByID(resourceGroupID,resourceGroupDesc); WorkQueueForm.GetType().GetMethod("setUpWorkQueueRecordsPageInfo",System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).Invoke(WorkQueueForm,null); oTrans.GetType().GetMethod("OnAfterResourceGroupSearch",System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).Invoke(oTrans,null); } --- ## Post #12 by @josecgomez I edited my earlier response it should be prop.SetValue(oTrans,true) instead of s --- ## Post #13 by @Chris_Conn Dude, I am now convinced, you are the BORG! What's your paypal, I owe you a case of beer - Works great! --- ## Post #14 by @josecgomez hehe no need just mark the answer as solution :slight_smile: --- ## Post #15 by @Chris_Conn Why do they force us to use a ResourceGroup? I'd love to use just a Resource (representing a machine). I am sure I can filter my results right in the EpiDataView though it would nice to make use of those Where clauses in the GetOpsInResourceGroup(). --- ## Post #16 by @TGCTSE OR ... You can Assign a Default Resource Group and Resource to the Employee ID and it will automatically pull that when you open the work queue: --- ## Post #17 by @Chris_Conn @TGCTSE Terry, awesome thanks! I'll see how that works tomorrow. --- **Canonical:** https://www.epiusers.help/t/debugging-tracing-system-button/36006 **Original content:** https://www.epiusers.help/t/debugging-tracing-system-button/36006