Time and Expense Reporting BPM

Hello,

I’m trying to set up a BPM for Time and Expense such that when an employee enters time, a check is made against labored.payhours to ensure they’re not entering more time than is appropriate. I’ve tried methods on Labor.Update pre and base processing to check those and if pay is less than labor, create an error message and it won’t do it.

Any suggestions would be welcome, thanks!

Zach

Have you made sure that you’re running your check on the pre-processing record against the added row in the temp table?

Thank you for the reply Aaron,

Which added row – it’s not until right at the end of update from what I can see that laborhed.totlbrhrs is updated. I can create a sheet rule to turn the box red but I can’t get the BPM to trigger at the right time.

I’ve tried the added row in laborhed, and using labordtl to trigger it.

Any ideas?

There should be an incoming value for the laborhed.payhours that is attempting to be submitted to the Labor.Update method.
I could be wrong, but the total hours is likely calculated after the method successfully completes, because it’s adding in what was passed into the method against what was already in the table.
Try this: using a custom code block, get the value of the added row for the pay hours. Then, do a lookup against the Labor table and get the current Total Hours value.
Perform the calculation of what it would potentially be if the method submitted without problems. If the value is what you expect, do nothing. If the value is greater than the time you want to allow, throw an exception.
This will prevent the method from actually updating the database and will force your user to enter the correct info.

It also sounds like you’ve tried this using a form customization. I’d stick to the BPM approach first, then if you need a form customization to help enforce, you can always have it do a lookup on an event.

This is great – one question, what would constitute a custom code block? Are you suggesting ABL code in the Method Directive?

Yes, and I totally forgot you are in E9 and not E10, so I won’t be able to help very much with the ABL :slight_smile:
I bet we could fight our way though it though, it can’t be that difficult. Make sure you build it on the pre-processing method directive and not the base.

Awesome, thank you. I will give it a try and advise on how it goes.

I understand 10 would be easier, we’re just not there yet.

Thanks for all your help.

Zach

Attached is the ABL I use to stop over reporting of production quantities pre-processing on Labor.Update.

You should be able to adapt it from quantities to hours.

Greg

Thank you Greg but I don’t see the code?
How do I retrieve an attachment or could you paste it here for me?

Thank you so much,

Zach

I changed the extension from .p to .txt

If this doesn’t come thru then send me your email address.

MODS: can we send .p extensions?

Greg

Stop Over Reporting of labor Qty V2.txt (2.33 KB)

This is excellent Greg, I’m impressed and the .txt works fine.

One further question, what’s the significance of the numbers at the start? 9906? Is that specific to your op set?

I’m new to ABL and am more of an updatable dashboard creator.

Thanks

Zach

Yes, the customers and 9906 are specific to us. I just sent you the whole thing since I knew it would compile.

I got the main parts of this from the previous Yahoo group, so it not totally a creation of mine.

you can now :slight_smile:

Thanks Rob

Hello Greg,

I’d created a pre-processing method directive and included the code. It will not trigger for me. I’m trying to us a labordtl.submittedby changed from any to any and it won’t trip the check.

How do you trigger yours and at what time?

Thanks,

Zach

Make your row mod “A” and try that

I’ve tried that – and E, and S in case it was sticking there. It won’t trigger.

Any other ideas? Do I have to import the method into a customization? I thought it should just activate when the condition is met.

BPMs are independent of form customization as they act server side rather than client side.
Since this is the Update method, it will require you to “save” the transaction before it will fire. Have you performed a trace log of the transaction you are building on to make sure you’re targeting the correct method?

Yes, I’ve run the trace. It won’t be saved, it’s just submission and that may be the issue.

Would it make more sense to trigger it on a change to say labordtl?

I believe you are on the right method, because as soon as the user tries to save, it will perform this calculation. If the calculation fails your criteria (as specified in the code) and the BPM throws an exception, the method will not actually complete and save data to the database.