1 2 Previous Next 16 Replies Latest reply on Nov 30, 2015 3:20 PM by user17

    FDMEE Email Notification

    MikeTO

      Hi All,

       

      I have setup an AftConsolidate Event jython script that sends me an email with each load's process status (import status, validation status, etc.) when a user loads data.  My plan is to add each user's email address to their location's Integration Option box and have them receive the email.  That is all fine.

       

      The only issue I have is that I only receive emails from successful loads and not those that fail along the way.  AftConsolidate only gets triggered if the load successfully makes it that far so I am wondering where you would put a script that would give you an update on loads that failed, let's say during validation.  Do I need to track the progress in each event script?  If the process fails during validate, an email script in BefValidate would be of no use as it has already past and AftValidate wouldn't be invoked as the load wouldn't had made it that far.

       

      Any ideas?

       

      Thx,

      Mike

        • 1. Re: FDMEE Email Notification
          Payal Kapoor

          Hi Mike,

          You will have to setup the email notification in  AftValidate and AftExport event scripts. Use :

          status = fdmAPI.getProcessStates(fdmContext["LOADID"])

          and check the value of status["IMPSTATUS"] and status["VALSTATUS"] to get the status of the import and validate steps.

          Similarly, use this same function and check the status of export - status["EXPSTATUS"] in the AftExport event script.

           

          Write your import and validate failure logic in the AftValidate event script and Import, Validate, Export success and Export failure logic in the AftExport script.

           

          AftValidate event will be triggered in case of mapping failure i.e. if a mapping is missing for any source dimension member.

           

          Hope this helps,

          Thanks and Regards,

          PK

          • 2. Re: FDMEE Email Notification
            MikeTO

            Thx.  I am noticing that my ExpStatus isn't returning the proper code from the AftExportToDat script.  I get 0 (not started or failure) even though the export is succeeding and the processstates code is 21 (Export OK).  Are there issues with ExpStatus returning the proper result?  I can see in the process log just prior to aftexporttodat.py being invoked, the following successful record for each period being loaded:

             

            UPDATE TLOGPROCESS

                    SET PROCESSENDTIME = CURRENT_TIMESTAMP

                    ,PROCESSSTATUS = 21

                      ,PROCESSEXP = 1

                      ,PROCESSEXPNOTE = 'Export Successful'

             

            My code in AftExport looks like this:

             

            stat = fdmAPI.getProcessStates(fdmContext["LOADID"])

            expStatus = str(stat["EXPSTATUS"])
            fdmAPI.logInfo(expStatus)

            Any ideas?

             

            Thx,

            Mike

            • 3. Re: FDMEE Email Notification
              Payal Kapoor

              AftExportToDat will still show EXPSTATUS as 0 since the actual export has not yet happened to the target application, only an export file has been created. You should check the EXPSTATUS in the AftExport event.

               

              Regards,

              PK

              • 4. Re: FDMEE Email Notification
                MikeTO

                Hi Payal,

                 

                There is no AftExport in FDMEE that I am aware of...just AftExportToDat.  I tried to manually make an AftExport.py file but it doesn't show up as being run in the logs following the execution of the DLR.  Are you thinking of FDM Classic?  Please advise.

                 

                Thx,

                Mike

                • 5. Re: FDMEE Email Notification
                  SH_INT

                  Not sure why you are doing this:

                  stat = fdmAPI.getProcessStates(fdmContext["LOADID"])

                  expStatus = str(stat["EXPSTATUS"])

                  when

                  fdmContext["EXPSTATUS"]

                  would suffice.

                  Also if you want to check whetehr or not the export (aka load to the target system has succeeded or failed put your coude in the AftLoad event

                  • 6. Re: FDMEE Email Notification
                    MikeTO

                    Hi SH,

                     

                    I cannot get my ExpStatus or ValStatus to work without referencing the processstates line first.  Here is a snippet from Oracle Support KB (

                     

                    How to use the Process Status property in scripts to generate e-mail alerts based on the failure/success of the events? The fdmContext does return the correct status. The fdmcontext gets initialized at the start of the process and the status is not available. You can use the following to get the status. The following prints the status to a log file:

                    stat = fdmAPI.getProcessStates(fdmContext["LOADID"])
                    fdmAPI.logInfo(str(stat["IMPSTATUS"]))
                    fdmAPI.logInfo(str(stat["EXPSTATUS"]))

                     

                    Also, putting in BefLoad doesn't change anything as that doesn't work either.  If I put valstatus in Befload it works and returns a 1 but expstatus always provides a zero.  Any ideas?

                     

                    Also, can we confirm that AftExport does not exist in FDMEE and AftExportToDat is the only option?

                     

                    Thx,

                    Mike

                    • 7. Re: FDMEE Email Notification
                      SH_INT

                      AftExport only exists in FDM not FDMEE. I suppose the reason EXPSTATUS always returns a zero is because FDMEE treats the following 3 events ExportToDat, Load and Consolidate if enabled as part of the Export process. Therefore if you want to know whether an Export has succeded check the status in the AftLoad event if you don't have the consolidation option enabled and the AftConsolidate if the consolidation option is enabled.  

                      • 8. Re: FDMEE Email Notification
                        Payal Kapoor

                        Sorry Mike, I meant AftLoad - got confused with the two versions. Apologies if that wasted your time. Did you put your code in AftLoad and check?

                         

                        Regards,

                        Payal

                        • 9. Re: FDMEE Email Notification
                          Francisco Amores

                          Can you try something like this in your event script AftLoad?

                           

                          status = fdmAPI.getProcessStates(fdmContext["LOADID"])

                          if str(status["EXPSTATUS"]) == "1":

                             .......

                          • 10. Re: FDMEE Email Notification
                            MikeTO

                            Yes, that works in AftLoad and always did.  Clearly the ExpStatus context value doesn't get populated until AftLoad.  I was able to workaround this by getting the ProcessStatus context value and making an if statement checking if it's 21 or not.  21 is a successful export per the TLOGPROCESSSTATES table in FDMEE.

                             

                            In the end, b/c AftLoad is all part of the Export process (thanks SH), I can just put the ExpStatus in there.  I thought there may be an error that would shut down the process during export but as long as the AftLoad is always called, I think we are covered.

                             

                            So now, an email is sent when VALSTATUS fails in AftValidate (with mapping errors attached) or EXPSTATUS fails in AftLoad (with .err file attached).  If successful, AftConsolidate sends a successful email.  This should allow our users to not stare at their screens for 10 minutes during multiload DLR processes.

                             

                            Thx,

                            Mike

                            • 11. Re: FDMEE Email Notification
                              1292171

                              Hi Mike

                               

                              I am also trying to develop a code to associate each user's email address to their unique location. I would appreciate if you can share your code. That would be very helpful. can you please send me the jython code in my personal email id bekta49@yahoo.com?

                               

                              Thanks

                              EB

                              • 12. Re: FDMEE Email Notification
                                MikeTO

                                For me (not a consultant), the simplest way would be to just enter the email address in a location integration option field and retrieve it:

                                 

                                rsLoc = fdmAPI.getLocationDetails(fdmContext["LOCKEY"])

                                 

                                while(rsLoc.next()):
                                  locDetailsList = rsLoc.getString("PARTINTGCONFIG2")
                                rsLoc.close()

                                 

                                The jython email to field would need this:

                                 

                                toaddr = locDetailsList

                                 

                                You can get fancier by tying it into the user that last updated the data load (I think Francisco wrote about this in the past) but this is a simpler approach if you don't mind updating the location everytime the user moves on.  Hopefully this points you in the right direction.

                                 

                                Mike

                                • 13. Re: FDMEE Email Notification
                                  SH_INT

                                  Can we close this thread as I believe a solution has been found to the original query. Thanks.

                                  • 14. Re: FDMEE Email Notification
                                    user17

                                    Hello Mike,

                                     

                                    Did you accomplish this by making

                                     

                                    stat = fdmAPI.getProcessStates(fdmContext["LOADID"])

                                    expStatus = str(stat["PROCESSSTATUS"])

                                    if expStatus == "21":

                                    1 2 Previous Next