Hi Robert,
Actually, my post was a bit misleading. The example is actually in the
API download from the website. After you extract all of the files look in
the samples folder \arapi.net\Samples\VBScript\CreateEntry.vbs
Here is the sample code.
'********************************************
'*** Code for server.CreateEntry() method ***
'********************************************
Const formName = "z" ' Some dummy form with an attachment field with id
536880912 on it
Dim server, fieldValues, attach, entryId, result
Set server = CreateObject("BMC.ARSystem.Server")
Set fieldValues = CreateObject("BMC.ARSystem.FieldValueList")
Set attach = CreateObject("BMC.ARSystem.Attachment")
server.Login "localhost", "Demo", ""
' Create an entry
fieldValues.Item(2) = 1
fieldValues.Item(7) = 3
fieldValues.Item(8) = "Hello from Appajee!"
Dim attachFieldId
attachFieldId = 536880912
Call attach.SetValue("My Test Attachment File", "C:\Temp\foo.txt")
fieldValues.Item(attachFieldId) = attach
entryId = server.CreateEntry(formName, fieldValues)
WScript.Echo entryId
' Get that entry back
Dim retFieldValues
Set retFieldValues = server.GetEntry(formName, entryId)
Dim fieldId
For Each fieldId In fieldValues.Fields
WScript.Echo "Field " & CLng(fieldId) & " = " &
fieldValues.Item(fieldId)
Next
' We know we have an attachment, so retrieve it
' In a production implementation however, the above fieldValues should
be looked up to
' see indeed we got an attachment value, then retrieve the BLOB value
based on that field
' id and with temp file name with same extension. Basic point is that
you need to dynamically
' retrieve BLOB values by looking up the GetEntry returned field values.
Call server.GetEntryBLOB(formName, entryId, attachFieldId,
"C:\Temp\MyRetrievedFile.txt")
Call server.Logout
' Cleanup
Set entryId = Nothing
Set result = Nothing
Set fieldValues = Nothing
Set attach = Nothing
Set server = Nothing
Kern, Robert SBA wrote:
>
> Hello Cevans,
>
> I would love to have a link to the Website with that example.
>
> Thanks :-)
>
> Robert
>
>
> -----Original Message-----
> From: Action Request System discussion list(ARSList)
> [mailto:[EMAIL PROTECTED] On Behalf Of cevans
> Sent: Saturday, January 13, 2007 6:24 PM
> To: [email protected]
> Subject: Re: Using VB Script to Add an Attachment in Remedy
>
> Thanks for everyones help. I was able to get this to work using the
> example
> provided on the website which I had looked at before but could not get
> past
> a logon problem. long story short using:
>
> server.Login "localhost", "Demo", "password"
>
> Instead of:
>
> server.Login "localhost", "Demo", "password", ""
>
> Got me past my issue and the example then helped me the rest of the way.
>
> Thanks!!!
>
>
> George T.-2 wrote:
>>
>> If the attachment is always in the same folder with the same name, you
>
>> could use a filter to retrieve the attachment during a submit/modify
>> action.
>>
>>
>>
>>
>> On Fri, 12 Jan 2007 14:37:02 -0800, cevans <[EMAIL PROTECTED]>
> wrote:
>>
>>>Hi, Does anyone have an example of how to use VB Script to add an
>> Attachment
>>>to an entry in Remedy? If so I would sure appreciate it. Thanks!
>>
>>
> ________________________________________________________________________
> _______
>> UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
> ARSlist:"Where
>> the Answers Are"
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/Using-VB-Script-to-Add-an-Attachment-in-Remedy-tf2
> 968771.html#a8316037
> Sent from the ARS (Action Request System) mailing list archive at
> Nabble.com.
>
> ________________________________________________________________________
> _______
> UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where
> the Answers Are"
>
> _______________________________________________________________________________
> UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where
> the Answers Are"
>
>
--
View this message in context:
http://www.nabble.com/Using-VB-Script-to-Add-an-Attachment-in-Remedy-tf2968771.html#a8370759
Sent from the ARS (Action Request System) mailing list archive at Nabble.com.
_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where the
Answers Are"