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
      • Online Knowledge Base
      • 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
    • Derdack Podcast
    • 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

    Enterprise Alert 9.4.1 comes with fixes and the revised version of the sentinel connector app

    February 1, 2023

    Critical System Alerts via SIGNL4

    December 29, 2022

    Enterprise Alert 9.4 Update introduces Remote Actions for hybrid scenarios and proxy support for MS Teams

    October 25, 2022

    Upgrade your shopfloor alerting with Derdack

    September 8, 2022

    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)
    • How to forward alerts to Microsoft Teams
    • Oncall Scheduling On-Call Schedule Management with Auto-Rotation
    • checking-mobile Enhancing SCOM alert notifications
    • Announcing Enterprise Alert 2019
    • Even, Alert, Incident, Notification Definition of Event, Alert, Incident and Notification
    • who-is-on-call-sharepoint Add a live “Who is On-Call” Dashboard into Sharepoint and other Tools

    Categories

    • Business (37)
    • Cloud Services (5)
    • Consultancy (1)
    • Customers (18)
    • Energy & Utilities (7)
    • Events (23)
    • Financial & Banking (4)
    • IT Ops (19)
    • Manufacturing (8)
    • News (48)
    • Schools (1)
    • Software (9)
    • Staffing (1)
    • Support (4)
    • Technical (141)
    • Transport & Logistics (5)

    Tags

    alert alert notifications Anywhere Resolution Anywhere Response Azure azure BMC customer reference Database derdack enterprise alert Enterprise Alert Enterprise Alert 2016 Enterprise Alert 2019 Gartner HPE HPE ITSM incident Incident Management Incident resolution incident response Industrie 4.0 Integration IT Alerting IT Operations Maintenance microsoft mobile Mobile App monitoring OMS on-call on-call schedule Operational Alerting rapid response release Remote Action REST API SCOM security 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
    CH: +41 (31) 5391990

    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
    • LinkedIn
    • XING
    • YouTube
    • Vimeo

     © 2022 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
        • Online Knowledge Base
        • 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
      • Derdack Podcast
      • Contact Derdack
    • News & Blog
    • Request Demo
    Manage Cookie Consent
    We use cookies to optimize our website and our service.
    Functional Always active
    The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
    Preferences
    The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
    Statistics
    The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
    Marketing
    The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
    Manage options Manage services Manage vendors Read more about these purposes
    View preferences
    {title} {title} {title}