Jump to content
  • Freshdesk Integration - B.1 - Access/modify the code behind

    Freshdesk Integration - B.1 - Access/modify the code behind

    How to make your own modifications or simply just take a look onto the implementation to get an idea of how everything works?

     

    The following explanations will refer to the VBScript version, the Lua version however is more or less identical in its structure.


    The entire code of this integration is located in one single file, FreshdeskIntegration.vbs.

     

    image.png

     

     

     

    All functionality is encapsulated in a class (FreshdeskClass), which defines properties for all parameters (with some validation) as also private and public methods.

     

    To make use of the FreshdeskClass class the FreshdeskIntegration.vbs file must be included first. This is done in the "Start" block of the GSE Action or your own GSE rule.

     

    '#inlcude "FreshdeskIntegration.vbs"

     

    image.png

     

     

    Afterwards the class needs to get instantiated, its properties set and the needed public method/function called. The return value of the function is either "0" (ok) or "1" (failed), so it can be used directly for the exits of a "Insert Script Code" or "Run GSE Action" block.

     

    image.png

     

     

    And this is exactly what the GSE actions of this project are doing.


    In order to make modifications it is not simply possible to modify the FreshdeskIntegration.vbs file and re-upload it again into the SwyxWare database. This is because the file is digitally signed, which is necessary to get it included with the #include statement.

     

    The easiest way to do your own modifications is to forget about the FreshdeskIntegration.vbs file all together and use just its content within a start block of a GSE rule (instead of the #include statement), but without the digital signature. 

     

    You can strip the signature yourself from the code (first line and all lines from the bottom), or simply use the content of the start.vbs file from the "vbs" folder or the download package.

     

    VBScript based\vbs\start.vbs

     

    So just do all your modifications within the start.vbs file and afterwards just copy & paste the entire content of the file into the "Start" block

     

    image.png

     

     

    and then use the Insert "Insert Script Code" block to instantiate the FreshdeskClass and call its functionality

     

    Dim c, sReturn
    Set c = new FreshdeskClass
    
    with c
      .sDomain       = "mycompany"
      .sAPIKey       = "1234567890123"
      .sContactEmail = "test@test.com"
      .sSubject      = "My first Ticket"
      .sDescription  = "Please call me asap!"
      .nSource       = 3
      .nStatus       = 2
      .nPriority     = 2
      sReturn        = .CreateTicket
    end with
    
    Set c = Nothing
    
    UseExit = sReturn
    

     

     

    It is highly recommended to not do any code modifications directly in the Start block, but instead use a proper editor like VS Code or Notepad++.

     

    image.png

     

     

    You are now free to to any modifications within the code and use it afterwards in your own GSE rules.

     

     

    If you want to update the FreshdeskIntegration.vbs in the end, you need to update its signature as well. This can be done with the "SignScript" tool which can be found in the Enreach Partner Net (you need a partner login).

     

    In order to get get your own .vbs file signed, make sure that the text encoding is UTF-8-BOM. This can easily be checked/configured with Notepad++.

     

    image.png

     

     

    Please feel free to ask any questions regarding the code, implementation or distribution (signing, including, etc.) in the Open ECR Extensions forum.

     

     

    Most of the above mentioned is also true for the following extensions. So there is lots more to explore ;) 

     

     

     


    Tom Wellige
     Share


     Share




×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.