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
salesForceUsersalesForceUser 

Hi facing a wierd probelm with the object Ids...

Hi,

I think I am doing something wrong here but really can't figure out what. Maybe someone can help?

I am integrating an opportunity over and I can the id to be =  00630000000oOem

http://localhost:8080/sforce/Login?taskId=oppGenerate&oppPublicId=00630000000oOem

 

 

but when i query the OpporunityContactsRole and get the opportunity id I get it as 00630000000oOemAA

Confused about this.

Any help is appreciated. I am blocked because of this right now.

 

DevAngelDevAngel

Hi salesForceUser,

I think the ID you are recieving from the OpporunityContactsRole is 00630000000oOemAAX where X is another character.  Maybe you didn't copy the whole id.

In any case, both ids reference the same object.  The app uses 15 char ids and the API uses 18 character ids.  I know it sounds silly, but up until recently both API and the app used 15 char ids.  People where having case-sensitivity issues because the ids are case-sensitive.  So, when a user exported salesforce data to a db like MS Access and tried to use the ID as a primary key, the db would not recognize the case-sensitive nature of the ids and complain about duplicate PKs.  The resolution was calculate three extra characters that could be added to the end of the id to prevent the problem.  To convert an 18 char to 15 char id, you just chop off the last three chars on the right.  You can send 18 or 15 char ids with the API and the web service won't complain.  The ids are still stored internally as 15 chars and that is why the app shows 15.

Hope this helps.

Cheers

salesForceUsersalesForceUser

Hi Dave,

Sorry i posted the same message in a different thread. As mentioned there I use 15 char Ids, but am getting this exception now...

 

java.rmi.RemoteException: web service invoke failed: javax.xml.soap.SOAPExceptio
n:  failed to serialize class urn.enterprise.soap.sforce.com.Retrieveweblogic.xm
l.schema.binding.SerializationException: string length must equal 18.  Invalid s
tring: "00630000000yOOD" - with nested exception:
[weblogic.xml.schema.binding.DeserializationException: string length must equal
18.  Invalid string: "00630000000yOOD"]; nested exception is:
        javax.xml.soap.SOAPException:  failed to serialize class urn.enterprise.
soap.sforce.com.Retrieveweblogic.xml.schema.binding.SerializationException: stri
ng length must equal 18.  Invalid string: "00630000000yOOD" - with nested except
ion:
[weblogic.xml.schema.binding.DeserializationException: string length must equal
18.  Invalid string: "00630000000yOOD"]

DevAngelDevAngel

Hi SalesforceUser,

I assume you are using weblogic, is this correct?  If so, are you using xmlBeans or "plain old java" classes?  Most proxy clients do not enforce the 18 character restriction from the wsdl.  Weblogic, on the other hand does.  I think that a change in the wsdl definition should be made by salesforce.com to remove that restriction as both 15 and 18 character IDs are valid.  I would recommend using 18 characters as a best practice.  If you must use 15, then you will need to modify your wsdl as follows:

The original wsdl definition for the ID object is:

    <!-- Our simple ID Type -->
            <simpleType name="ID">
                <restriction base="xsd:string">
                    <length value="18"/>
                    <pattern value='[a-zA-Z0-9]{18}'/>
                </restriction>
            </simpleType>

Change it to:

    <!-- Our simple ID Type -->
            <simpleType name="ID">
                <restriction base="xsd:string">
                    <pattern value='[a-zA-Z0-9]'/>
                </restriction>
            </simpleType>

 

After saving these changes, regenerate the proxy code and re-try your application.

Cheers