You need to sign in to do that
Don't have an account?
sergii poluektov
OData4: Salesforce sets id to '/x' when retrieving an external object.
Hi everyone,
I am now trying to build an OData 4 service so that Salesforce can access the external data.
So far I was able to get the list view of the external objects with pagination. However when I am trying to access a particular object
I get an HTTP error "400 Bad request". When I inspect the used URL I see that the key property "id" is set to '/x' (%2Fx if encoded) instead of the real id, which can even be seen in the list view.
Here is the decoded URL: https://ecme.empolis.com/oauth/LegoService/LegoService.svc/events?$top=2&$filter=id eq '%2Fx'&$count=true&$select=description,id,sensorId,severity,timestamp,unitId,value
I tried some sample oData4 services provided by odata.org and there the key property is set to its actial value in the same situation.
What can be the reason? How can I fix it?
I am now trying to build an OData 4 service so that Salesforce can access the external data.
So far I was able to get the list view of the external objects with pagination. However when I am trying to access a particular object
I get an HTTP error "400 Bad request". When I inspect the used URL I see that the key property "id" is set to '/x' (%2Fx if encoded) instead of the real id, which can even be seen in the list view.
Here is the decoded URL: https://ecme.empolis.com/oauth/LegoService/LegoService.svc/events?$top=2&$filter=id eq '%2Fx'&$count=true&$select=description,id,sensorId,severity,timestamp,unitId,value
I tried some sample oData4 services provided by odata.org and there the key property is set to its actial value in the same situation.
What can be the reason? How can I fix it?
In the mean-time, you could always write a custom VF page that pulls the data via SOQL and pushes it out to the page.
thanks for the reply.
Here are some thoughts that may help finding the issue:
It would be great if someone could look at it one more time.
Looking at an event (from https://ecme.empolis.com/oauth/LegoService/LegoService.svc/events), I don't think there's enough detail here for us to retrieve an individual event: In my sample Olingo OData 2.0 database, id is an absolute URL for the entry record, and link is relative to the entity set url. From http://orderdb.herokuapp.com/orders.svc/Orders/ GET on http://orderdb.herokuapp.com:80/orders.svc/Orders(1002) returns just that entry, as expected: I've been unable to figure out the corresponding query to get a single event record from your service. I tried https://ecme.empolis.com/oauth/LegoService/LegoService.svc/events(AVCqmenbMGipdmTLFABN) , but it gives an error: "The key value 'AVCqmenbMGipdmTLFABN' is invalid." I also tried https://ecme.empolis.com/oauth/LegoService/LegoService.svc/events/AVCqmenbMGipdmTLFABN , but got "The property 'AVCqmenbMGipdmTLFABN' must not follow a collection."
I'm not an expert on the OData 4.0 spec, but, looking at this, I think you need a URL per event record, and to supply that URL in the id field.
following your advice I have implemented the retrieval of the individual elements with queries like
http://orderdb.herokuapp.com:80/orders.svc/Orders(1002)
The good news is that I can execute the SOQL queries for the events as well as for the sensors. But still it would be nice to be able to show the external objects in a native tab.
"The external system responded with an HTTP error "400 Bad Request". The system tried to reach this URL: https://orderdb.herokuapp.com/orders.svc/Orders?$top=2&$filter=orderID+eq+/x&$select=customerID,orderDate,orderID,shippedDate"
So, I would like to know what happened with this point Pat said: "We are passing '%2Fx' as the id. I'm still investigating why this is happening."
If a change the '/x' for a number, let's say '1' the URL works fine and I can see the XML returned by the browser corresponding to the Order details I wanted to see. But inside my dev ORG, I can't do this in order to get it working.
Do you guys already know about this in the Lightning Connect Example in the link provided before?
Thanks in advance!