I have added a checkbox to the Job Close form to indicate the job has been cancelled. I would like to have the date stored in the Job Completed Date field when the new box is checked. I have tried setting the read only property for the date box to be false when the flag is checked. I have noticed that if I put it in the CheckedChanged event it fires twice, where the first time the date field is enabled but the second time it goes back to being disabled. I have tried putting the code in several of the events (Click, CheckValueChanged, AfterFieldChange), but none of them enable the field.
What is the proper click event to get the Job Complete Date field enabled (not read only)?
That is the event that fires twice. I have a message box that shows it firing inside each part of the if statement and it pops up twice. The first time I can see the date enabled but the second time it becomes disabled again. How do I keep it from either firing the second time or not changing the read only back to true?
I would like the user to enter the date, not just set it to today (which I assume would be the BPM solution).
I deleted the customization and put it back with just the CheckChanged event but I still have the same issue. It keeps setting the Completed date field back to read-only. Guess it is time for BPM code to force today’s date in even though that is not what I want.
For some reason this Date field is stumping me. I gave up on trying to enable the CompletedDate field since it would never enable it (I did delete the form customization and only added the CheckChanged event but it still would not enable it). I am trying the BPM route. I have tried post and pre processing on the JobClosing.PreCloseJob event (see attached design). I traced the events when checking the completed box to get to the JobClosing.PreCloseJob event. In each case I was not able to get the date to save. I manually updated the jobHead when attempting post-processing and just setting the field in the pre-processing. I can see my messages come out with the proper data but it isn’t saving the data to the field or database.
Is there some sort of Epicor control that is stopping me from update the JobCompletedDate field?
As for the closing date itself. That might be trickier, as there might be an Epicor BO that updates that field. I would have to run a trace to see.
You can use a BPM form. Which is a pop up window when the BPM fires. You can default information as well. Here is an example of a BPM form; you can see there is information flowing into the form that the user can update. You can also make the fields required and even customize the form as needed. Lots of possibilities.
I second this suggestion. Create a UD JobCancelled field in the DB. Then run a BPM on Job Updates that will run the normal JobClosing methods. I would not just try to set the field on JobHeader. Use the BO’s.
I’ll also add, from personal experience, that sometimes you have to use UpdateExt instead of Update to prep jobs for closing automatically.
Regardless, there are specific BO’s that handle JobComplete and JobClosing. It’s not something you can just set in Job Entry, which is why you keep running into issues. You also seem to be trying to set the date field, but not the associated JobComplete boolean field. If memory servers, you really just need to set JobHead.JobComplete to true, and the BO’s will tag the date.
You’ll have more success working with the flow of the system than trying to hack around it.
I was trying to use my own flag independent of the close or complete flag but I was trying to use the Complete Date field which does not appear possible. I am creating a date field to go with the cancelled field I have added so I can set it. Guess sometimes you can’t hijack fields.
I have added a UD field for the date instead of using the Completed Date. Unfortunately I still can’t turn on and off the read only for that field within the Job Complete/Close form. I am giving up on allowing the user to set the date field and am setting it to Today in the BPM. That works fine. Now my issue is if the uncheck the box I want to clear the date, but not matter what I try it gives me errors that I can’t set the date to null. I have tried to fake it out by creating a date variable in the BPM, setting that to null, then setting my Cancel date to the variable but that doesn’t work either. Nothing seems to let me wipe out the date.
How do I get the date to clear so that if they uncheck the box it will clear out the date?
Here is where things get weird. I have tried using the Before Adapter Method for both Select (JobHead) and Close (JobClosing) and neither one are firing. I have put in message boxes to show me they are getting into the code and I get no messages at all.
I am fine with the BPM route if I can just get the date field to clear if the user unchecks the custom checkbox. How do I set the date to null or empty string without it giving the error that I can’t set the field to null?