Run BSFN on exit

shortdog

Active Member
Is there any BSFN or other hook that can be used to execute some logic ( like calling a BSFN) when the user exits E1. I know some stuff is getting executed that closes things like vertex, etc. I'd like to run a BSFN that tries to close or free up resources a user may have left open.

I'm specifically looking in 9.2 but would be interested if there are solutions for earlier releases.

I did search but didn't find any results, so I am guessing there isn't a solution for this.
 
You answered your own question. The E1 "bootstrap" process calls a BSFN that loads vertex and other user session init stuff, and like you said, another BSFN gets called when the E1 session terminates on the enterprise server as part of the session unbinding process. I have modified this BSFN to execute code when a user's E1 session is terminated. Just do so with EXTREME caution!!! There may be more "official" or better ways to do this but I am not aware of what they might be. If there is a better way I am sure someone here will know.

B0000183 example
Code:
JDEBFRTN (ID) JDEBFWINAPI jdeFreeEnvBSFN(LPBHVRCOM lpBhvrCom,
                                         LPVOID lpVoid,
                                         LPDSD0000183 lpDS)
{
   /************************************************************************
    *  Variable declarations
    ************************************************************************/

   BOOL              bReturnValue         = FALSE;
   ID                idReturnCode         = ER_SUCCESS;
   ID                idJDBReturn          = JDEDB_PASSED;
   HUSER             hUser                = NULL;

   JDECM_RESULT      jdeCacheCode         = JDECM_FAILED;

   /* JCM - Related Variables GeoCode Initialize Cache*/

   HCACHE            hGeoCodeInitCache    = NULL;
   HJDECURSOR        hGeoCodeInitCursor   = NULL;
   JDECMINDEXSTRUCT  GeoCodeInitIndex[1];

   /* JCM - Related Variables Sales Tax Initialize Cache*/
   HCACHE            hSalesTaxInitCache   = NULL;
   HJDECURSOR        hSalesTaxInitCursor  = NULL;
   JDECMINDEXSTRUCT  SalesTaxInitIndex[1];

   /************************************************************************
    * Declare structures
    ************************************************************************/

   /* Declare a structure for GeoCodeInit */

   GeoCodeInit          dsGeoCodeInit;
   KEY1_GeoCodeInit     dsGeoCodeInitKey1;

   /* Declare a structure for SalesTaxInit */

   SalesTaxInit         dsSalesTaxInit;    /* Initialize Sales Tax Cache     */
   KEY1_SalesTaxInit    dsSalesTaxInitKey1;/* Initialize Sales Tax Cache Key */

   DSDE0022             dsDE0022;          /* Text substitution error      */
   DSD09X0901           dsD09X0901;
   DSD0000115           dsD0000115;
   DSD7300002           dsD7300002;
 
   /************************************************************************
    * Declare pointers
    ************************************************************************/

   /************************************************************************
    * Check for NULL pointers
    ************************************************************************/
   if ((lpBhvrCom == (LPBHVRCOM) NULL) ||
       (lpVoid == (LPVOID) NULL))
   {
      jdeErrorSet (lpBhvrCom, lpVoid, (ID) 0, _J("4363"), (LPVOID) NULL);
      return ER_ERROR;
   }

   /************************************************************************
    * Set pointers
    ************************************************************************/

   /************************************************************************
    * Main Processing
    ************************************************************************/
/*=============================================================================
  Acme Mod Begin
  =============================================================================*/
	jdeCallObject(_J("AcmeFreeEnvBSFN"), (LPFNBHVR)NULL, lpBhvrCom, lpVoid,
		(void *)lpDS, (CALLMAP *)NULL, 0, (JCHAR *)NULL, (JCHAR *)NULL, 0);
/*=============================================================================
  Acme Mod End
  =============================================================================*/
...

Then I just add my user session cleanup code to AcmeFreeEnvBSFN, which at the moment, is only one thing.
 
Back
Top