I traced a method for a receipt transaction and for a specific vendor there is always a pop up that says, “are you sure you would like to do this?” They always click yes and then it proceeds to finish the transaction, but I don’t know how to do this in the code. I see that after clicking yes it runs the “update master,” method again, but with different parameters so I tried that in my code, but then I get a null reference error.
In short, how do you handle messages in a function or a BPM that would normally pop up in the UI?
The trace shows that it calls update master when I do it from the normal receipt entry UI and then the message pops up and I click yes, then it calls update master again, but this time with different parameters.
Now in my function I am going to check the dataset after the first update master call and if there is a question message about the UOM calculation, I will send the dataset through a second update master call with the different parameters as I mentioned above.
I just tested if I could do that successfully and it worked.
John, I don’t see a parameter like that. I really think it is looking at the qmessage parameter and then throwing the message box if its value is different from “”.
You could try setting that parameter to “” and then you might not have to call the second update master? Just a thought, but sounds like your way is working.
I tried that the other day cause I have done that for things like the “are you sure you want to…” messages, but I got an error message that threw me off track… so I think I gave up and chalked it up to “not working.” Let me try that again now that I have fixed the error message that was unrelated.
I typically decompile the client side of things to understand these prompts. The screen code will show what variables are checked causing the prompt. JetBrains dotPeek is free for this, and many others might recommend something like .NET Reflector (paid).
You’ll find the BOs used in each of the screens’ Transaction class. As a consultant, this was one of the most valuable tools when making automations.
For example, in Erp.UI.VendorEntry.dll, you’ll find the VendorTransaction class. This is the oTrans object and all of the BO usages will be from here.
It’s pretty consistent amongst most of the UIs, but you’ll find annoying differences. Like in one, I found the oTrans update method was protected. Little bit of reflection and problem solved.
I might be totally off beam here, but is it anything like the “quantitycontinue” field you have to set if you try to automate job closing? In the UI, if you try to clise a job and the quantity of material is less than required you get a prompt. In DMT or a BPM, you have to set the field “quantitycontinue” to the integer 1.
Why an integer I’ll never know, but it means “yes” to that prompt. I’d check the DMT version of receipt entry for some kind of confirmation or continuation field.