Mass close stuck tickets
Jump to navigation
Jump to search
When you have a large amount of stuck tickets, you can use the following javascript script to close multiple at once. Use the serviceIds array to set all tickets ids
const serviceIds = [1234, 1235, 1236]; var errorLog = []; for (var i=0; i<serviceIds.length; i++) { try { CommonInterface.callWebservice('Workflow - Stop Process Instance', { ProcessInstanceId : serviceIds[i], Log : 'Some comment line to explain why you closed the ticket', HashCheck : 'ExternalProviderKey', ProviderName : 'ExternalProviderName' }); } catch (err) { errorLog.push(serviceIds[i] + ' ' + err); } } return errorLog;
The webservice used here is "Workflow - Stop Process Instance" and that webservice is defined like this: XSLin:
<?xml version='1.0'?> <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0' xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ser="http://smt-x.com/Workflow/"> <xsl:template match='/SSPAdapterCall'> <soap:Envelope> <soap:Header /> <soap:Body> <ser:StopProcessInstance> <ser:ProcessInstanceId><xsl:value-of select="Field[@Name='ProcessInstanceId']" /></ser:ProcessInstanceId> <ser:Log><xsl:value-of select="Field[@Name='Log']" /></ser:Log> <ser:HashCheck><xsl:value-of select="Field[@Name='HashCheck']" /></ser:HashCheck> <ser:ProviderName><xsl:value-of select="Field[@Name='ProviderName']" /></ser:ProviderName> </ser:StopProcessInstance> </soap:Body> </soap:Envelope> </xsl:template> </xsl:stylesheet>
XSL out:
<?xml version='1.0' ?> <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ssp="http://smt-x.com/Workflow/" version='1.0'> <xsl:template match="/"> <SSPAdapterResult> <xsl:apply-templates select="/soap:Envelope/soap:Body/ssp:StopProcessInstanceResponse"/> <xsl:apply-templates select="/soap:Envelope/soap:Body/soap:Fault"/> </SSPAdapterResult> </xsl:template> <xsl:template match="/soap:Envelope/soap:Body/ssp:StopProcessInstanceResponse"> <Value>OK</Value> </xsl:template> <xsl:template match="/soap:Envelope/soap:Body/soap:Fault"> <Error>code:<xsl:value-of select='soap:faultcode' /><xsl:value-of select='soap:Code/soap:Value' /> - string:<xsl:value-of select='soap:faultstring' /><xsl:value-of select='soap:Reason/soap:Text' /></Error> </xsl:template> </xsl:stylesheet>
Extra settings
Type: SOAP URL: localhost /Workflow/WebService/WorkflowService.asmx Call Type: Retrieve Single Value Return Type: Single Value