Pacific Technology produce a number of modules that provide workflow automation on top of existing Sage 300 processes such as purchasing and payables. We’ve had a feature request to be able to run an external program at a particular point in the workflow. We can do that easily enough, but the program needs access to the user’s Sage 300 session.

We came across this blog post by Stephen Smith, which suggests we can pass the session handle into another program: https://smist08.wordpress.com/2013/07/06/launching-non-sdk-programs-from-the-desktop/

Since we’re in a superview, not the UI, we need to use a different method to get the session handle. We looked at getting the session handle out of the HSIB session information block, but that handle doesn’t seem to be in a format that the AccpacCOMAPI AccpacSession.Init method can handle.

We need a method we can call from within a superview to be able to extract the current session ID in a format usable by the COM API (or for the COM API to accept the format provided from the HSIB session information block).

Comments

  • You're not going to get much in the way of SDK type responses here, I suspect. That being said your session object can generate a new session handle using CreateObjectHandle2 (which is an integer) that can be passed to another program. The called program can use that value in the session.init call which gives it access to the calling session.