function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sigstersgsigstersg 

Call AccountId but I get error in VB.NET

Hi hope someone can help me Please I am tray to Call Salesforce from VB.NET


I am using sample I found online with enterprise.xml I am tray to call = AccountId but I get error  to call Account Name in Case

If you know how to do this in SforceProvider then Please

This is my Code

      Dim oResult As New QueryResult
        oResult = binding.query("SELECT AccountId,CaseNumber,Type,Reason,Status,Priority,Origin,Product__c,PotentialLiability__c,EngineeringReqNumber__c,SLAViolation__c,Subject,Description,CreatedById,OwnerId,LastModifiedById,ContactId,Id FROM Case where CaseNumber like  '" & TextBox12.Text & "%'")

            If Not oResult.records Is Nothing AndAlso oResult.records.Length > 0 Then
            Dim oCase As [Case]
            Dim oTable As New System.Data.DataTable

            For Each oCase In oResult.records

                Txt_CaseNumber.Text = oCase.CaseNumber
                Txt_Type.Text = oCase.Type
                Txt_Reason.Text = oCase.Reason
                Txt_Status.Text = oCase.Status
                Txt_Priority.Text = oCase.Priority
                Txt_Origin.Text = oCase.Origin

                Txt_Product__c.Text = oCase.Product__c
                Txt_PotentialLiability__c.Text = oCase.PotentialLiability__c
                Txt_EngineeringReqNumber__c.Text = oCase.EngineeringReqNumber__c
                Txt_SLAViolation__c.Text = oCase.SLAViolation__c

                Txt_Subject.Text = oCase.Subject
                Txt_Description.Text = oCase.Description

                Txt_CreatedById.Text = oCase.CreatedById
                Txt_OwnerId.Text = oCase.OwnerId
                Txt_LastModifiedById.Text = oCase.LastModifiedById
                Txt_ContactId.Text = oCase.ContactId
                Txt_AccountId.Text = oCase.AccountId

            Next

        End If

 

RichAintRichRichAintRich

Missing some object qualifications in your SOQL specifically where you specify the various Id fields at the end (missing periods). Try this:

 

SELECT Account.Id, Case.CaseNumber, Case.Type, Case.Reason, Case.Status, Case.Priority, Case.Origin, Case.Product__c, Case.PotentialLiability__c, Case.EngineeringReqNumber__c, Case.SLAViolation__c, Case.Description, CreatedBy.Id, Owner.Id, LastModifiedBy.Id, Contact.Id, Case.Id

FROM Case

 

I used SuperCell (Free edition) to work up my query and then display the working SOQL to be pasted into my code. Takes all the quesswork and trial-and-error out of my development tasks for SOQL. Here's a link to their website for the download:

 

SupeCell Product Download

 

Hope this helps.

 

Rich