Video Screencast Help

Adding An Attachment to an Incident Through Workflow Solution

Created: 22 Aug 2008 • Updated: 22 Aug 2008 | 11 comments
Language Translations
Alon's picture
+3 3 Votes
Login to vote

In its current state the Workflow component for creating an incident does not provide you a way to add an attachment to an incident. One workaround is to send an email to the Helpdesk system with the attachment in the email and the incident number in the subject heading. Here is a better way ...

The ASDK Helpdesk API provides a webservice that allows you to attach a file to an incident. The Helpdesk API should be installed along with the Workflow Solution installation. If not then you need to ensure that the Helpdesk ASDK is installed on your NS.

You can find the ASDK at http://www.altiris.com/download.aspx (select SDK - Administrator 1.4). The Helpdesk webservice that we will use is specifically located in http://[NSServerName}/altiris/asdk.helpdesk/incidentmanagementservice.asmx.

What we will do is the following:

  • create a custom component that calls the above webservice
  • create a project that utilizes the newly created component

I will divide up this article into 2 parts. Below I will discuss how to create the custom component for the incident attachment webservice. The second part of the article will discuss how to create a project to test out the new component.

First, let's create the custom component. From the Workflow Designer select "New" and then select "Integration". Let's call this Integration project AddAttachmentToIncident.

Next select "Web Service Caller Generator" from the select a generator window.

Click "next".

Next we will select "URL with Authentication" and enter the URL "http://{NSServerName}/altiris/asdk.helpdesk/incidentmanagementservice.asmx" and provide the correct credentials into the NS.

Click Next.

Now we need to fill in the namespaces and categories. Fill in the details as per the screen shot.

The Default Category specifies where within the component toolbox the component will reside. You can specify a new category or use an existing one. I placed my component within the existing Altiris category. Mine is specified as "Altiris.Service Desk.Tickets" This will place the component under this tree structure.

Under the Default URL Generation section I specified "Use and populate Project property". What this allows us to do is define the URL to the webservice as a project property. This way the component won't have a static URL to a specific NS. A project property will be pre-populated with the initial URL value, and when it comes time to publish the project using the new component you can specify an alternate URL, perhaps to a production NS.

Click Next.

Now you need to select the component of the webservice you would like. In our case we will select only the "AddIncidentAttachmentComponent"

Click Finish

Select Compile and Close.

Attached to this article is my package of the integration project discussed above.

Now, we need to create a project to test out the new component and attach a file to an incident.

First, we need to discuss how our file attachments will be treated in our project. The process to attach a file to a ticket will be as follows:

  • a user, from a browser on his/her local machine, will select a file
  • this file will need to be copied to an area accessible to the HD webservice
  • the component created in part 1 will reference the file copied in the above step

The tricky part is understanding how the webservice is called. When a user selects the file c:\test.txt, he is referencing a local file. If the webservice were to be called to attach file c:\test.txt to an incident, the webservice will be looking for the file in the filesystem local to where the webservice resides. It does not understand the file locally on the user's machine. Therefore, when the user selects a file in our project, we will need to write that file to an accessible location for the webservice, perhaps a UNC share.

In my example, I have Workflow server and my NS all on the same machine so there are no issues for me in referencing c:\test.txt for both Workflow and the webservice. Please keep this in mind when testing the project. I write the selected file to the c:\temp directory (retaining the same filename) and then have the webservice reference the same directory. In production I would probably write the file to a UNC share on the NS so that the webservice can reference the file locally or from the same UNC.

Attached is the package of the project that I used. It references the generated component that we created earlier in the article. To access the package either double click it on your machine with Workflow Designer, or, click File-->Open and select the package.

In the package you will find several simple components. A Dialog Workflow component to enter in the file and write it to the temp directory, a Create Ticket component and finally the newly created component called AddIncidentAttachmentComponent.

That's it.
Good luck.

Comments 11 CommentsJump to latest comment

endo's picture

Hi. Is there any way we can add an attachment automatically in Helpdesk without workflow solution? With an automation rule for example or other...

0
Login to vote
Andy Tous's picture

You could add an IMAP inbox to your Helpdesk and receive attachments through email.

For example:

If the end user sends an email to support@yourcompany.com, he/she must add the incident number to the subject line (like this: #00000) and that should add the users comments and the attachment to the existing incident.

However, if the end user does not place the #[incidentnumber] line, this procedure will create a brand new incident, but it will still attach the file included in the email.

Hope this helps!

0
Login to vote
endo's picture

Hi. I think you misunderstood the problem i adressed. I want to attach a document for instance a check list when for example a certain category is pickded og type is choosen.

0
Login to vote
Alon's picture

Unfortunately no. Your 2 options are to wait for Service Desk 7 to be released or build a simple Workflow to do this.

0
Login to vote
mike.gibson's picture

For a remote portal, we ended up creating the web page below, and mounting it in an iFrame, passing the ticket ID as a parameter attached the file.
The security is open in this example.
I've emboldened the relevant pieces:

<%@ Page Language="VB" %>
<%@ Import Namespace="System.IO" %>

<script runat="server">
Protected Sub Button1_Click(ByVal sender As Object, _
ByVal e As System.EventArgs)
Dim TicketNumber As String = Request.QueryString("TicketNumber")
If FileUpload1.HasFile Then
Try
FileUpload1.SaveAs("C:\Uploads\" & _
FileUpload1.FileName)

Label1.Text = "Succesfull copy to PLCANS02" & "<br>" & _
"File name: " & _
FileUpload1.PostedFile.FileName & "<br>" & _
"File Size: " & _
FileUpload1.PostedFile.ContentLength & " kb<br>" & _
"Content type: " & _
FileUpload1.PostedFile.ContentType
Catch ex As Exception
Label1.Text = "ERROR: " & ex.Message.ToString()
End Try
Try
Dim CallWebService As New plcans02_AttachToIncident.IncidentManagementService()
CallWebService.Credentials = New System.Net.NetworkCredential("symantec_upload", "Helpdesk1", "")
Dim sGetValue As String = CallWebService.AddIncidentAttachment(TicketNumber, "c:\uploads\" & FileUpload1.FileName, FileUpload1.FileName)

Label2.Text = sGetValue
File.Delete("c:\uploads\" & FileUpload1.FileName)
Catch ex As Exception
Label2.Text = "ERROR: " & ex.Message.ToString()
End Try

Else
Label1.Text = "You have not specified a file."
End If
End Sub

</script>

<html >
<head id="Head1" runat="server">
<title>Upload Files</title>
</head>
<body>
<form id="form1" runat="server">
<div style="width: 222px; height: 114px">
<asp:FileUpload ID="FileUpload1" runat="server" />
<br />
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"
Text="Upload File" />&nbsp;<br />
<asp:Label ID="Label1" runat="server"></asp:Label>
<br />
<asp:Label ID="Label2" runat="server"></asp:Label></div>
<br />
</div>
</form>
</body>
</html>

0
Login to vote
bricast's picture

I'm getting an error message that the remote server returned erro 404 page not found.
I'm entering in the flowing URL
http://[NSServerName}/altiris/asdk.helpdesk/incidentmanagementservice.asmx  with the nsservername as my workflow server.  I have also tried my HD server as the NS server name.  Both of thses have NS installed on the server.  What server should SDK - Administrator 1.4 be installed on?  What NS server should I use in the URL?

0
Login to vote
bricast's picture

Has anybody ever gotten this to work when the workflow server and the HD server are on two different boxes.

0
Login to vote
lone_ranger's picture

Any word on getting this to work when the Workflow Server is on another server besides the Helpdesk Server? I also tried copying the file to an open share on the network and I'm getting an access denied error when trting to attach the file. Both servers have my service account as an admin.

0
Login to vote
lone_ranger's picture

Error Details
Error Message:
Access to the path '\\server\share\test.xml' is denied.

Message Stack:
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at LogicBase.Components.Default.IO.WriteFile.Run(IData data)
at LogicBase.Core.ExecutionEngine.SinglePathProcessComponentExecutionDelegate.Execute(IData data, IOrchestrationComponent comp, String& outputPath, IExecutionEngine engine, TLExecutionContext context)
at LogicBase.Core.ExecutionEngine.AbstractExecutionEngine.DoRunComp(IOrchestrationComponent comp, IData data, TLExecutionContext context)

0
Login to vote
lone_ranger's picture

I finally got this to work in a debugging mode, but will not work when it is published. Does anyone have any idea?

0
Login to vote
lone_ranger's picture

I actually got this working using a workflow server that is not installed on my helpdesk server. I followed the above directions and made sure that the share for the files to be uploaded is on my workflow server and not the helpdesk server. I was also able to use UNC path to this share within the component.

0
Login to vote