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
SF ADMINISTRATORSF ADMINISTRATOR 

Returning Logical SalesForce API Values?

 Greetings Folks

I am new to this and have been thrown in to this project.  I am wondering if you can tell me why the following query returns garbled
strings as opposed to logical values.

For example, this should a Bin Location field (gii__BinLocation__c) from a custom table (gii__ProductInventory__c).  And it does, in fact,
do that.  But the field returned should be something like "F-5".  Instead, it looks like "a0Mi0000002lir9EAA".

Got any ideas?


        Dim results As JacoApex.QueryResult = Nothing
        results = bindingService.query("select gii__BinLocation__c from gii__ProductInventory__c WHERE Product_Name__c = '" & productid & "' ")


        If results.records Is Nothing Then
            Return ""
        Else
            Dim record As JacoApex.sObject = results.records(0)
            Dim sfval As String = getFieldValue(gii__BinLocation__c", record.Any)
            Return sfval
        End If

Jean-NoelJean-Noel
Hello,

Is the field gii__BinLocation__c a child in a lookup relationship ?
If it's the case, you'll need to use gii__BinLocation__r.Name
SF ADMINISTRATORSF ADMINISTRATOR

Hi Jean.  Thanks.  That does not seem to throw an error but it returns nothing. 

 

 gii__BinLocation__c is a Lookup field.

Jean-NoelJean-Noel
As it's a lookup field, the ID is the value stored in it, you'll need to update the query to return the value too like the following.

Dim results As JacoApex.QueryResult = Nothing
        results = bindingService.query("select gii__BinLocation__c, gii__BinLocation__r.Name from gii__ProductInventory__c WHERE Product_Name__c = '" & productid & "' ")

        If results.records Is Nothing Then
            Return ""
        Else
            Dim record As JacoApex.sObject = results.records(0)
            Dim sfval As String = getFieldValue(gii__BinLocation__r.Name", record.Any)
            Return sfval
        End If


SF ADMINISTRATORSF ADMINISTRATOR

Thanks Jean.  But that did not make any difference.  Not it just returns blank.  I even tried to hard code the query where I assume "a19i0000001phoE" is the ID of the item in the gii__ProductInventory__c table since the uRL for it is like this

https://na15.salesforce.com/a19i0000001phoE

And yes it has a bin.

        results = bindingService.query("select gii__BinLocation__c, gii__BinLocation__r.Name  from gii__ProductInventory__c WHERE ID = 'a19i0000001phoE' ")
        If results.records Is Nothing Then
            Return ""
        Else
            Dim record As JacoApex.sObject = results.records(0)
            Dim sfval As String = getFieldValue("gii__BinLocation__r.Name", record.Any)
            'Response.Write(pId)
            Return sfval
        End If


 

Jean-NoelJean-Noel
Hello,

The query should be correct, I suppose that getFieldValue is one of your function ? Could you publish the code for it ?
In debug, you can also check the value of record.any.