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.