Part Maintenance Audit Log - BPM to Log Unapprovals as well

Hey Epigurus,

I’ve had a request to prompt for comments and post to the audit log when a Part Revision is checked unapproved in Part Maintenance (this happens when Approved already by default).

(This post has what I’m trying to replicate Part Maintenance - PartRev - when approved, input box pops up, forcing entry of approval details, but want to do it when a revision gets unapproved as well)

So far, I’ve been able to create (buggy) records on the Audit Log that don’t actually seem to save, and I’m struggling to get all required fields to populate. I’m getting an error that required fields are missing (after the new record is viewable in the Audit Log).


My not-really-working solution so far consists of a Pre and Post Method directive on the Erp.Part.ChangePartRevApproved method. I ran a Trace when unchecking approved on the revision in part maintenance to get these. At this point, I’m not trying to replicate the text box. Just trying to get a valid row on the PartAudit Log first, then plan on using a BPM data form.

Pre: Checks if the approved field is false, then sets the description field that I think the error refers to and enables the post directive.

Post: Enabled from Pre directive, tried changing that same description field here as well, then invokes BO Method Part.GetNewPartAudit with the same ds.


Full error:

A few times, I did see “BPM test” (my message i set in the BPMs) in the change description textbox, but was still getting an error. Anything glaringly wrong with my approach here? Any help/suggestions are much appreciated!

Checked some more boxes on the trace log, and realized none of my field changes were doing anything as the Part.Update still had empty parameters. Probably because the GetNewPartAudit method hadn’t actually added a new row yet when I was previously updating the field. Ended up getting it working by adding the condition/field update to the Part.Update BO/method.

I am working on a similar project. Instead of using directives, I am working with a dashboard. I have already setup the part unapprove method, and reapprove method. But I noticed audit comments aren’t automatically requested. So I need to add an audit record every time the user makes a change with my dashboard.
I would like to automatically fill a change description for the GetNewPartAudit. Do I add the description within the method (I don’t see an applicable field for that), or do I use an update table by query widget?

Thanks, and sorry for reviving a dead post!

Hey Nate,

Here’s how I did it in the Part.Update method. It’s somewhere in the dataset generated from GetNewPartAudit so you could do “update table by query” or “Set field” (if the table/dataset isn’t completely empty).

Hope that helps!

1 Like

Thank you! The Part Audit log is almost working. I also have to set a ChangeTime for the record. It wants an int32. I tried to use this bit of code to get the value but I keep getting an overflow error.


This syntax doesn’t have any errors, only when I run the update action do I see the overflow error. It is pointing to the conversion of the date/time to an integer. I also tried the same syntax without the .Ticks in there. It also compiled fine, but still gave an error.

Invalid cast from 'DateTime' to 'Int32'.

How did you set the int32 ChangedTime field in the PartAudit record?

I fortunately didn’t have to deal with that! It must have been set automatically for me in one of the methods.

I think that BpmFunc.Now() function may include some other date info (day/month/year) other than just the current time which may be why it’s overflowing the int when you try to convert it, but that’s just my best guess.

1 Like

I figured it out. I had to set the DspChangeTime, not the ChangeTime. I set it to:


Seems to work ok. Thanks!

1 Like