Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

FlexDeploy has out of box integration with ServiceNow, BMC Remedyforce, and Freshworks Freshservice, and Jira ITSM, and provides a framework to enable custom integrations with other change management systems. Such third party Change Management System integrations can be enabled using a Java or Groovy implementation.

...


Method Name

Parameter(s)
Return Type

Description

createTicket

Map<String,Serializable> pTicketFieldsvoid

Creates a Change Request ticket using the pDescription and pComment

createIncident

Map<String,Serializable> pTicketFieldsString

Creates an Incident ticket using the pDescription and pComment

findCMSObjectByType

String pCMSObjectNumber

ChangeManagementSystem.CMSObjectType pCMSObjectType

void

Find a "ticket" or "incident" using the object identifier and type. The object type will be TICKET or INCIDENT, and implementations must translate that into the corresponding object type within the provider (e.g. Problem, Request, etc.) 

isTicketApproved

CMSObject pTicket

String pEnvironmentCode

BooleanReturns whether the ticket is approved in the CMS. 
isTicketRejected

CMSObject pTicket

String pEnvironmentCode

BooleanReturns whether the ticket is rejected in the CMS.

checkConnection

N/Avoid

This method should invoke any status or heath check URL of the change management system to ensure the system is up and running and a connection can be authenticated.  This method will be called when the Test Connection button is clicked on the CMS Instance.

isDoPolling

N/A

void

Returns whether FlexDeploy should automatically poll the CMS to identify whether the ticket is approved or rejected.  If polling is enabled FlexDeploy will lookup the ticket every 1 minute using findCMSObjectByType and then check the status using the isTicketApproved and isTicketRejected methods.

If polling is not enabled, the CMS or another external system is responsible for approving/rejecting the associated task using the FlexDeploy REST API.

getTicketURLCMSObject pCMSObjectStringreturns the REST API url of the change ticket


Tip

If your usage of the CMS will not include the automated creation of TICKET or INCIDENT objects the API can be simplified.  Although createTicket and createIncident are required to be implemented, if you are not using these auto-creation features you can choose to simply throw an exception from one or both methods as appropriate.

Code Block
languagejava
themeMidnight
titleExample
throw new UnsupportedOperationException("createIncident is not supported for Zendesk CMS integration");createIncident is not supported for Zendesk CMS integration");



Tip
titleAdd custom task notes
@since 5.5.0.2

With out-of-the-box CMS providers including BMCHelixRemedyforce, ServiceNow, JiraITSM, and Freshworks, you have the ability to add notes to a FlexDeploy External Approval upon approval or rejection. Custom Change Management Systems have the same functionality. Can do so by overriding the following getAdditionalTicketInfo in your Groovy API. It takes CMSObject and environment code as parameters and must return a Map<String, String>.

Code Block
languagegroovy
themeMidnight
titleSimple Example
def getAdditionalTicketInfo(CMSObject pTicket, String pEnvironmentCode)
{
  // Create notes to add to External Approval
  def changeNumber = pTicket.getNumber()
  def map = {'notes': 'Approval note for ' changeNumber + ' added by FD admin'}
  return map
}



Java Implementation

Here are high level steps for Java implementation. You can use any IDE to prepare this implementation. 

...

  • In order to compile your java class, you will need FlexDeployAPI.jar on classpath.
  • Implement all the methods described in the table in the API Implementation section.
  • For any failure connecting to the system or if any issues with the data, then you can throw exception. For example throw new ApiException("Invalid credentials.", "");
  • Once you are ready with unit testing, you can prepare Jar file for your credential store java class and other utility classes. This jar file can be placed on server classpath now.
    • For Tomcat, put this jar file in apache-tomcat-flexdeploy/lib folder.
    • For WebLogic, put this jar file in Domain lib folder.
    • If you are using any third-party libraries from your Java implementation, then those jar files will also need to be added to same lib folder. Keep in mind that this can cause issues with server functioning, so be prepared to remove your additional library files.
  • To pickup changes to your API, the FlexDeploy server must be restarted.

...

  • Create a groovy class. Example shown below has the methods implemented.
  • We are using Zendesk as a usec aseuse case
  • All properties defined are available as groovy binding variables. For example, properties can be accessed directly like BMC_DOMAIN_NAME, BMC_SALESFORCE_HOST_NAME or BMC_USER_NAME etc

...

There are some utility variables provided by FlexDeploy that can be used in your custom Groovy code.

  • log is a FlexDeploy logger variable which should be used to log any information from the groovy class.
  • fdrestutils is a utility object available to use FlexDeploy API to invoke any REST API.
  • testConnection(String pHostName, String pUrl, String pUserName, String pPassword)
  • getRequest(String pHostName, String pResourcePath, String pUserName, String pPassword) - Returns javax.json.JsonObject
  • postRequest(String pHostName, String pUserName, String pPassword, String pResourcePath, String pResourceName, String pPayload) - Returns boolean
  • putRequest(String pHostName, String pUserName, String pPassword, String pResourcePath, String pPayload) - Returns boolean See the Java docs for more details on the functions available.


    Code Block
    languagegroovy
    themeEmacs
    def builder = new groovy.json.JsonBuilder()
    def root = builder.issue
    {
        notes "${pComment}"
    }
    String payload = builder.toString();
    String ticketNumber = ticket.getNumber();
    String resourcePath = REDMINE_TICKET_REST_PATTERN.replaceAll("\\{REDMINE_ISSUE\\}", ticketNumber)
    fdrestutils.putRequest(REDMINE_URL, REDMINE_USER_NMAE, REDMINE_PASSWORD, resourcePath, payload);