Call BPM data form in External dll for Method directives

Hi, I’m using external DLLs in Data and Method directives.
I want to pop a simple BPM data form in a Post-Processing method directive.

I found that MethodDirectiveBase has a method BpmDataFormProcess(string formId) which call the form but the problem is that it takes a Session and method parameters.

public abstract class MethodDirectiveBase<TCtx, TSession, TParam> : DirectiveBase<TCtx, TSession, TParam>
  where TCtx : IceContext
  where TSession : Session
  where TParam : MethodParameters

I assume that I can create a class for TParam which inherit from MethodParameters but I don’t know how to get the session. Is it even possible from an external dll?

Can I ask why you are going with an external DLL?

Generally this causes dependency issues and it can be a bit of a nightmare to implement. I’ve never called a BPM form from an external DLL though I suspect you could perhapse… I’ll do some investigating however again why go with an external DLL?

You should be able to do everything you need inside a regular BPM screen, are you invoking this external DLL from your BPM?

Yes I do Invoke an external dll in my BPM. I do it for every directive I’m hooked up to.

I do realize it is a nightmare to implement that why all I do is making a call to a secure API which does everything needed through WCF which means I very rarely redeploy new versions of the external DLL.

I recently discovered the BPM data form and I realized it could be interesting to use it sometimes to simplify the implementation in the server which modifies Epicor data.

In order to call a BPMDataForm I believe you’ll have to implement CustomizationBase in your class which can very complex. One thing you can do, is call the BPM data form from inside the BPM and then go back to your external DLL with the results.

1 Like

I too have discovered the BPM form… I went along to even customize the form to add some code but … Did not find how to make sure the customized version is used by the users… as we do setup our customized forms in menu maintenance…

Can it be done ? if so how?

Pierre

I thought of that but didn’t give it a try yet thinking it might not be possible. I though with BPMs it’s either you use an External dll which has the same signature that the BPM method itself or you make the flow.
Does that mean I have to change the signature or I keep it as it is and just try to get the answers from callContextBpmData which I assume require also an inheritance but easier to implement.

When you say “Invoke BPM Form” one of the options is “Invoke BPM Form with Customization XXX” you can there pick the customization.

You would have to make the Flow and Invoke your external methods as needed. Then when you need a BPM DataForm you call it from the flow.

giving it a try atm! giving feedback soon!


I do not have cutomization but thats what @josecgomez is talking about. You can always create a basic flow with the designer and than go check in Epicor folder the source code to see exactly how it is used!

EpicorServerName\Server\BPM\Sources\BO\Entity.Method\version

1 Like

And it was even simpler than I thought. I didn’t need to inherit from any class.

    public class NewQuoteAttachment : INewQuoteAttachment
    {
        private ErpContext dataContext;

        public NewQuoteAttachment(IceDataContext context)
        {
            this.dataContext = (ErpContext)context;
        }

        public void GetNewQuoteDtlAttch(QuoteTableset ds, ref int quoteNum, ref int quoteLine, ContextTableset context)
        {
             var bpmData = context.BpmData.Any() ? context.BpmData[0] : null;
             new ApiSession().AddQuoteDtlAttachmentAsync(quoteNum, quoteLine, bpmData);
        }
    }

Thnx for the hint @josecgomez. So I assume it doesn’t matter when or how I call an external dll in a BPM flow from now on! :smiley:

1 Like