I would like it to happen on the first Dispatch Requisition Entry. I tried using a Method Directive using the Erp.ReqActs.GetNewReqActs table and a Data Directive using the ReqHead, but can’t figure out what condition on what table would trigger the Show Message value. Is this even possible?
The ReqHead.StatusType gets updated to “P” (pending) from “” (blank string) whenever the dispatch requisition goes through, you could try a data directive on that table and check for that update. If you want a message as soon as the action is clicked (rather than after the requisition is dispatched), you could do a form customization with an after tool click event.
Thank you Adam! I’ll give that a try.
Hi Adam,
I tried a few different things based on your suggestion and have identified that I actually would like the alert to trigger when the ReqHead.NextActionID is changed from null to “APPROVE”. In the Form Event Wizard, I used a simplified BeforeFieldChange event as shown below to trigger a message when updating the Action drop down selection. The problem is that it only triggers after clicking OK in the Dispatch Requisition form. I’d like it to display as soon as the Action is selected. Further, I’d like it to only trigger if the Action selected has the Action ID “APPROVE” or the ActionDesc “6-Approve Req”. I tried inserting an if statement to do that but it was causing errors. I continue to work on it and welcome any further suggestions.
private void ReqHeadList_BeforeFieldChange(object sender, DataColumnChangeEventArgs args)
{
// ** Argument Properties and Uses **
// args.Row["FieldName"]
// args.Column, args.ProposedValue, args.Row
// Add Event Handler Code
switch (args.Column.ColumnName)
{
case "ReqActionIDReqActionDesc":
{
MessageBox.Show("TEST");
}
break;
}
}
Which form are you customizing? The Erp.UI.App.ReqEntry.ReqEntryForm or the dispatch requisition form App.ReqEntry.DispatchForm?
The App.ReqEntry.DispatchForm
Try using the ReqHead dataview instead of ReqHeadList, I was able to get a message to show afterfieldchange on ReqHead.NextActionID
I tried it and it does work, but it launches just before the form loads and again when the Action drop down is populated. I only want it to trigger when the Action drop down is populated. I’m sure it has to do with where I’m placing my message statement.
You should be able to add your if statement before the message to limit when it fires, something like if(args.ProposedValue == "APPROVE")
should work
I placed the if statement as follows and it is not triggering the alert. I do see a possible error in the result of the Test Code. Thanks for your patience as my C# skills are limited…
Strange, I didn’t get that error. Try changing it to args.ProposedValue.ToString()
I also realized the text that’s displayed on the dispatch form is related to the action description, not the ID. Is “APPROVE” the actionID?
Yes, “APPROVE” is the ActionID. The ActionDesc would be “6-Approve Req”.
Alex,
I left the code using the ActionID and added your suggestion to revise args.ProposedValue.ToString(). That did it! Thank you so much for your time and help!
Here’s the script:
private void ReqHead_AfterFieldChange(object sender, DataColumnChangeEventArgs args)
{
// ** Argument Properties and Uses **
// args.Row["FieldName"]
// args.Column, args.ProposedValue, args.Row
// Add Event Handler Code
switch (args.Column.ColumnName)
{
case "NextActionID":
if(args.ProposedValue.ToString() == "APPROVE")
{
MessageBox.Show("TEST");
}
break;
}
}