Derdack

Targeted Alert Notifications – Anywhere Actions

Derdack
  • Use Cases
    • Overview
    • Enterprise IT Alerting
    • IT Managed Services
    • Mobile Alerting in Manufacuring
    • Critical Operations Alerting in Banking & Financial
    • Field Service Dispatching in Energy & Utilities
    • Use Cases in other Industries
  • Products
    • Overview
    • Enterprise Alert®
      • Overview
      • Alert Notifications
      • On-call Duty Scheduling
      • Collaboration
      • Anywhere Remediation
      • Incident Mgmt. App
      • Integrations
      • Technical Support
      • Derdack FAQ
    • SIGNL4® Cloud
    • References & More
  • How to Buy
    • Overview
    • Pricing and Quotes
    • Find a local Partner
    • Azure Marketplace
  • About Derdack
    • About
    • Careers
    • Partner Program
    • Strategic Partners
    • Contact Derdack
  • News & Blog
  • Request Demo
    • de de
  • News & Blog

    • Home
    • News & Blog
    • Technical
    • How to set yourself as a Stand-In for an On-Call Team from your Mobile?

    How to set yourself as a Stand-In for an On-Call Team from your Mobile?

    • May 9, 2017
    • Technical
    How to set yourself as a Stand-In for an On-Call Team from your Mobile?

    Imagine the situation where your colleague is on-call but he has an important, unplanned appointment. He calls you if you can cover him for two hours. Of course you can. Wouldn’t it be convenient now if you can just manage this easily from your mobile app? You can. You just need two things in Enterprise Alert:

    1. A Remote Action with the form to set you as stand-in
    2. The script that does the work for you in the background

    Here we go ….

    Remote Action

    The Remote Action form allows you to set (or delete) yourself as a stand-in for a specific on-call team at a specific time.

    You can add the Remote Action under “Remote Actions” -> “Remote Actions” -> “Create New” and then configure it in the following way.

    General:

     

    Action:

     

    Under the Action you define to execute a script (see below). The mentioned parameters will be passed to the script as function arguments. In this example we provided a list of team names the user can choose from.
    Script

    The above Remote Action calls a script which does the processing on the database. For our example the script looks as follows.

    /*
    This script writes values into a database table.
    
    Add;Delete
    
    00:00;00:30;01:00;01:30;02:00;02:30;03:00;03:30;04:00;04:30;05:00;05:30;06:00;06:30;07:00;07:30;08:00;08:30;09:00;09:30;10:00;10:30;11:00;11:30;12:00;12:30;13:00;13:30;14:00;14:30;15:00;15:30;16:00;16:30;17:00;17:30;18:00;18:30;19:00;19:30;20:00;20:30;21:00;21:30;22:00;22:30;23:00;23:30
    
    2017;2018;2019;2020
    
    01;02;03;04;05;06;07;08;09;10;11;12
    
    01;02;03;04;05;06;07;08;09;10;11;12;13;14;15;16;17;18;19;20;21;22;23;24;2;26;27;28;29;30;31
    
    © 2017 Derdack GmbH, www.derdack.com
    Copyright 2016 - 2017 Derdack GmbH, www.derdack.com, Enterprise Alert is a registered trademark of Derdack GmbH
    
    Author: Hanno Ferdinand
    Versions:
    16.03.2017 HF 1.0 Initial version
    */
    var strVersion = "RA_SetStandIns 16.03.2017 v1.0 ";
    
    /*
     =============================================================================
     CONFIGURATION
     =============================================================================
     */
    
    // Enterprise Alert database connection string
    var APPCONFIG_DB_EA_CONNECTIONSTRING = "Driver=SQL Server Native Client 10.0;Server=(local);Trusted_Connection=Yes;Database=MMEA";
    
    
    //Testfunctions
    //EAScriptHost.LogDebug("Service2Ticket() :" + SetStandIn("Add", "hferdi","Database", "2017-03-20","12:00","13:00")); 
    //EAScriptHost.LogDebug("Service2Ticket() :" + SetStandIn("Delete", "hferdi","Database", "2017-03-20","12:00","13:00")); 
    
    EAScriptHost.LogInfo("Execute Remote action Startup " + strVersion);
    
    /*
     * Still to set 
     * 
     */
    function SetStandIn(Modus,Teamname,TimeStart,TimeEnd,Year,Month,Day,Username) {
    
     //Modus Delete StandIn or Add StandIn
     //shortDate - Today, Tomorrow, After tomorrow
     
     //Time Start 00:00 00:30 01:00 
     
     var oConnInternalDB = null;
     var bInTransInternalDB = false;
     var oExec = 1; 
     var allOut = ""; 
     var allError = ""; 
     
     try {
    
     // Open the db connection
     //
     oConnInternalDB = new ActiveXObject("ADODB.Connection");
     oConnInternalDB.IsolationLevel = 1048576; // Set the isolation level
     // to
     // Serializable
     oConnInternalDB.Open(APPCONFIG_DB_EA_CONNECTIONSTRING);
     EAScriptHost.LogDebug("Db Internal Connection Opened");
     oConnInternalDB.BeginTrans();
     
     //find Team and PlanUserID 
     //SELECT [TeamOnCallPlans].[OnCallPlanID], [OnCallPlanUsers].[ID], [OnCallPlanUsers].[ProfileDisplayName], MMPROFILES.PROFNAME
     //FROM [TeamOnCallPlans],[OnCallPlanUsers], MMPROFILES where [TeamOnCallPlans].[OnCallPlanID] = [OnCallPlanUsers].[OnCallPlanID] and MMPROFILES.ID = OnCallPlanUsers.[ProfileID] and TeamDisplayName like 'Database' and MMPROFILES.PROFNAME like 'hferdi'
     
     //Modus,Username,Teamname,ShortDate,Date,TimeStart,TimeEnd
     EAScriptHost.LogDebug("Modus " + Modus + " " + Username + " " + Teamname + " " + Year + " " + Month + " " +Day + " " + TimeStart + " " + TimeEnd + " ()");
     
     var sDateStart = Year + "-" + Month + "-" +Day + " " + TimeStart + ":00.000"; 
     var sDateEnd = Year + "-" + Month + "-" +Day + " " + TimeEnd + ":00.000"; 
     
     //Insert into 
     if (Modus.indexOf("Add") > -1 ){ 
     
     //in die internen Tabelle: OriginatorAddress 
     /*ID OnCallPlanUserID DateStart DateEnd Hierarchy Options
     181 20 2017-03-16 16:00:00.000 2017-03-16 17:00:00.000 0 3
     */
     EAScriptHost.LogDebug("INSERT INTO OnCallPlanShifts (OnCallPlanUserID, DateStart, DateEnd, Hierarchy, Options) Values ((SELECT TOP 1 [OnCallPlanUsers].[ID] FROM [TeamOnCallPlans],[OnCallPlanUsers], MMPROFILES where [TeamOnCallPlans].[OnCallPlanID] = [OnCallPlanUsers].[OnCallPlanID] and MMPROFILES.ID = OnCallPlanUsers.[ProfileID] and TeamDisplayName like '" + Teamname + "' and MMPROFILES.PROFNAME like '" + Username + "'), '" + sDateStart + "', '" + sDateEnd + "',0,3)"); 
     oExec = oConnInternalDB.Execute("INSERT INTO OnCallPlanShifts (OnCallPlanUserID, DateStart, DateEnd, Hierarchy, Options) Values ((SELECT TOP 1 [OnCallPlanUsers].[ID] FROM [TeamOnCallPlans],[OnCallPlanUsers], MMPROFILES where [TeamOnCallPlans].[OnCallPlanID] = [OnCallPlanUsers].[OnCallPlanID] and MMPROFILES.ID = OnCallPlanUsers.[ProfileID] and TeamDisplayName like '" + Teamname + "' and MMPROFILES.PROFNAME like '" + Username + "'), '" + sDateStart + "', '" + sDateEnd + "',0,3)");
     allOut = "Standin Inserted"; 
     EAScriptHost.LogInfo("Standin Inserted ");
     
     }
     
     if (Modus.indexOf("Delete") > -1 ){ 
     
     //Delete FROM OnCallPlanShifts where OnCallPlanUserID = (SELECT TOP 1 [OnCallPlanUsers].[ID] FROM [TeamOnCallPlans],[OnCallPlanUsers], MMPROFILES where [TeamOnCallPlans].[OnCallPlanID] = [OnCallPlanUsers].[OnCallPlanID] and MMPROFILES.ID = OnCallPlanUsers.[ProfileID] and TeamDisplayName like '" + Teamname + "' and MMPROFILES.PROFNAME like '" + Username + "') and DateStart = '" + sDateStart + "' and DateEnd = '" + sDateEnd + "' and Options = 3 
     oExec = oConnInternalDB.Execute("Delete FROM OnCallPlanShifts where OnCallPlanUserID = (SELECT TOP 1 [OnCallPlanUsers].[ID] FROM [TeamOnCallPlans],[OnCallPlanUsers], MMPROFILES where [TeamOnCallPlans].[OnCallPlanID] = [OnCallPlanUsers].[OnCallPlanID] and MMPROFILES.ID = OnCallPlanUsers.[ProfileID] and TeamDisplayName like '" + Teamname + "' and MMPROFILES.PROFNAME like '" + Username + "') and DateStart = '" + sDateStart + "' and DateEnd = '" + sDateEnd + "' and Options = 3");
     allOut = "Standin deleted"; 
     EAScriptHost.LogInfo("Standin deleted ");
     }
     
     oConnInternalDB.CommitTrans();
     oExec = 0; 
    
     } catch (e) { // catch all thrown errors
    
     try {
     EAScriptHost.LogError("Error processing event. Error message (Exception): " + e.message);
    
     if (bInTransInternalDB == true && bInTransInternalDB != null) {
     oConnInternalDB.RollbackTrans();
     }
     allError = allError + e.message; 
     
     } catch (e2) {
     EAScriptHost.LogError("Error processing exception. " + e2.message);
     allError = allError + e2.message;
     }
    
     } finally {
    
     try {
    
     // Release all resources at the end of message processing
     //
     
     if (oConnInternalDB != null) {
     oConnInternalDB.Close();
     oConnInternalDB = null;
     }
     EAScriptHost.LogDebug("Resources released.");
    
     } catch (e3) {
     EAScriptHost.LogError("Error releasing resources. " + e3.message);
     
     }
    
     if (oExec != 0) {
     EAScriptHost.LogError("Error Exited with code: " + oExec);
     RAContext.SetExecutionResult(RAContext.ExecutionError, allOut + allError, oExec);
     } else {
     EAScriptHost.LogInfo("ExecuteCommand: Successful executed values inserted");
     RAContext.SetExecutionResult(RAContext.ExecutionOK, allOut, 0);
     }
     }
    }
    
    //Returns an ADODB.Recordset object for the specified query
    function DbGetRS(oConn, strSQL) {
    
     // Set some constants
     var adOpenStatic = 3;
     var adLockBatchOptimistic = 4;
    
     // Declare our variables
     var oRS;
    
     // Create the Recordset object
     oRS = new ActiveXObject("ADODB.Recordset");
    
     // Populate the Recordset object with a SQL query
     oRS.Open(strSQL, oConn, adOpenStatic, adLockBatchOptimistic, 0);
    
     // Return the Recordset
     return oRS;
    }
    
    
    //Gets a date string for the date object
    //
    function GetDateString(date)
    {
     
     var strDate = date.getFullYear().toString() + "-" + GetDoubleDigit((date.getMonth() + 1).toString()) + "-" + GetDoubleDigit(date.getDate().toString()) + " " + GetDoubleDigit(date.getHours().toString()) + ":" + GetDoubleDigit(date.getMinutes().toString()) + ":" + GetDoubleDigit(date.getSeconds().toString()) + "." + GetTripleDigit(date.getMilliseconds().toString());
     return strDate;
     
    }
    
    // Gets a double digit for the date
    //
    function GetDoubleDigit(strText)
    { 
    
     var strOutput;
     if (strText.length == 1)
     strOutput = "0" + strText;
     else 
     strOutput = strText; 
     return strOutput;
     
    }
    
    function GetTripleDigit(strText)
    { 
     var strOutput;
     if (strText.length == 1)
     strOutput = "00" + strText;
     else if (strText.length == 2)
     strOutput = "0" + strText;
     else
     strOutput = strText; 
     return strOutput;
     
    }
    

    This is it and of course you can adapt this to fit your needs. One very convenient enhancement is to fill in the team names automatically with another script but this is something for another blog article.

    Tagged

    Appon-callStand-Inteam

    Share

    Related Posts

    Empowering Remote Users

    December 9, 2020

    Tips & Tricks: Keeping track of user profile changes

    December 3, 2020

    Secure mobile Authentication with Azure Active Directory

    November 13, 2020

    Enterprise Alert 2019 Update 8.5.1 released

    October 9, 2020

    About

    DERDACK products combine automated alert notification workflows, 24/7 duty scheduling, ad-hoc collaboration and anywhere IT troubleshooting – reducing unexpected IT downtimes at large enterprises and organizations by 60%.

    Most popular

    • Derdack Company Take your ITIL incident management to the next level with Enterprise Alert
    • Mobile alert notifications for HP Service Manager (HPSM)
    • Enterprise Alert® 2015: Flood Protection is so cool!
    • How to forward alerts to Microsoft Teams
    • Oncall Scheduling On-Call Schedule Management with Auto-Rotation
    • checking-mobile Enhancing SCOM alert notifications
    • Even, Alert, Incident, Notification Definition of Event, Alert, Incident and Notification
    • Announcing Enterprise Alert 2019

    Categories

    • Business (34)
    • Customers (13)
    • Energy & Utilities (7)
    • Events (23)
    • Financial & Banking (4)
    • IT Ops (17)
    • Manufacturing (6)
    • News (43)
    • Technical (105)
    • Transport & Logistics (4)

    Tags

    alert alert notification alert notifications Anywhere Resolution Anywhere Response azure Azure customer reference Database derdack enterprise alert Enterprise Alert Enterprise Alert 2016 Enterprise Alert 2019 HPE HPE ITSM incident Incident resolution incident response Industrie 4.0 Integration IT Alerting IT Operations Maintenance microsoft Mobile App monitoring OMS on-call on-call schedule phone PowerShell rapid response release REST API SCADA SCOM scsm security SMTP SolarWinds NPM System Center update User Group voice

    Follow us

    • Twitter
    • Facebook
    • LinkedIn
    • XING
    • YouTube
    • Vimeo
    • Home
    • News & Blog
    • Technical
    • How to set yourself as a Stand-In for an On-Call Team from your Mobile?

    CONTACT US:
    Intl: +49 331 29878-0

    US: +1 (202) 470-0885
    UK: +44 (20) 88167095

    CONTACT VIA EMAIL:
    info@derdack.com

    OFFICES:
    US & Europe

    NEWSLETTER:
    Sign up here

    CAREER:
    Latest job offers

    EVENTS

    • No Upcoming Events
    • Who we help
    • Products
    • How to Buy
    • About Derdack
    • News & Blog
    • Free Trial
    • Twitter
    • Facebook
    • LinkedIn
    • XING
    • YouTube
    • Vimeo

     © 1999-2021 Derdack – Imprint, Privacy policy

    • Use Cases
      • Overview
      • Enterprise IT Alerting
      • IT Managed Services
      • Mobile Alerting in Manufacuring
      • Critical Operations Alerting in Banking & Financial
      • Field Service Dispatching in Energy & Utilities
      • Use Cases in other Industries
    • Products
      • Overview
      • Enterprise Alert®
        • Overview
        • Alert Notifications
        • On-call Duty Scheduling
        • Collaboration
        • Anywhere Remediation
        • Incident Mgmt. App
        • Integrations
        • Technical Support
        • Derdack FAQ
      • SIGNL4® Cloud
      • References & More
    • How to Buy
      • Overview
      • Pricing and Quotes
      • Find a local Partner
      • Azure Marketplace
    • About Derdack
      • About
      • Careers
      • Partner Program
      • Strategic Partners
      • Contact Derdack
    • News & Blog
    • Request Demo