• algot algot
  • NEWBIE
  • 20 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
I have created a C# project, connect Salesforce Enterprise WSDL as WebReference and trying to create the Contact
 
var recordTypes = sforceService.query("select Id from RecordType where sObjectType = 'Contact'"); 
var contact = new Contact { 
  LastName = textTemplate, 
  RecordType = (RecordType)recordTypes.records[0], 
  Email = textTemplate + "@test.com", 
  Phone = "1234567890", 
}; 
res = sforceService.create(new sObject[] { contact });

And get an error: 
"Field name provided, Id is not an External ID or indexed field for RecordType"

How should I set RecordType in this case?
I have created a C# project, connect Salesforce Enterprise WSDL as WebReference and trying to create the Contact
 
var recordTypes = sforceService.query("select Id from RecordType where sObjectType = 'Contact'"); 
var contact = new Contact { 
  LastName = textTemplate, 
  RecordType = (RecordType)recordTypes.records[0], 
  Email = textTemplate + "@test.com", 
  Phone = "1234567890", 
}; 
res = sforceService.create(new sObject[] { contact });

And get an error: 
"Field name provided, Id is not an External ID or indexed field for RecordType"

How should I set RecordType in this case?
Hello,

I am trying to access API through .NET by following the steps mentioned in following link https://github.com/developerforce/Force.com-Toolkit-for-NET/blob/master/samples/SimpleConsole/Program.cs . For some reason i get error stating "One or more errors occurred,authentication failure"
I have double checked my credentials to ensure they are proper.
Can anyone tell me what can be possible reson for this error or if there's any other way to access API using .NET