You need to sign in to do that
Don't have an account?

ASP.NET with VB.NET CASE creation
I am creating a new case with the API in ASP.NET with VB.NET, got this to work. I would like to set the recordType to one of three types I have setup in SFDC. But with my Case object the recordType can only be set to a sforce.recordType, Error 1 Value of type 'String' cannot be converted to 'sforce.RecordType'. How do you set the record type of a new case with the API?
Message Edited by scottskiblack on 05-01-2007 02:35 PM
Public Function GetRecordTypeID() As String
login()
' query for the recordtype to set it
Dim recordtypeId As String = Nothing
Dim qStr As String = "Select Id, Name, SobjectType from RecordType where Name='SFDC Requests Record Type'"
Dim qr As QueryResult
Try
qr = binding.query(qStr)
Catch ex As Exception
Throw New Exception(ex.Message & vbCrLf & ex.StackTrace)
End Try
Dim records() As sforce.sObject
records = qr.records
' process the query result
If (Not qr Is Nothing) Then
'we can loop through the returned records
For i As Integer = 0 To records.GetUpperBound(0)
'While (Not qr.records Is Nothing)
'Because we asked for contacts we will convert
'the SObject for each record into an Contact object
Dim record As sforce.RecordType = CType(records(i), sforce.RecordType)
'Now we can access any of the fields we had in the query
'select clause directly from the contact variable
recordtypeId = record.Id
'End While
Next
Else
End If
Return recordtypeId
End Function