Javascript in the Business Process Flow: header_process_ and postfixes

By Robin Pietens

Some things you run into make you go: ‘Oh yeah, totally forgot about that’. I hope most of you don’t have this happen all that often. I ran into one of them a few days ago and thought I’d share.

I was adding a custom filter to a lookup-view in the business process flow, as you can’t change the view in version 8.2 of Dynamics 365 via normal configuration. I ran into a problem where the filter worked on some fields in the flow, but not all. After spending quite some time on this I came to the below conclusions.

When customizing the business process flow via Javascript, you have to take into account that Dynamics adds ‘header_process_’ as a prefix to your fieldname. In addition, there is something else Dynamics does that is less obvious, and maybe less known as it won’t occur all the time. Dynamics adds a postfix of _X to each field that’s repeated in the same business process flow. X here is the next occurrence, starting with 1. The reason this is hard to spot is that it happens all the way at the end of the schema name of a field. Even if you use a tool like the Power Pane (which I would recommend), you probably won’t see the postfix in the schame name unless you hover over it to appear in full.

In my specific case, I work with a branched business process flow in which two similar stages exist, but you only ever see one of them. The invisible stages of the business process flow are also taken into account when the postfixes are appended. I didn’t know about this, and didn’t look closely enough at the exact schema names!

Another reason the search can take so long is that your code doesn’t actually give any errors. It simply doesn’t execute!

Hope this helps some of you out.

Leave a Reply

Your email address will not be published. Required fields are marked *