+ Start a Discussion

AJAX API describeLayout(strObject,arrRecordTypeIds) call always ignores 1st Record Type?

I am using version 33.0 of the JavaScript AJAX Toolkit (/soap/ajax/33.0/connection.js), and am making a describeLayout() call. I am trying to retrieve a limited subset of the describeLayout metadata --- specifically, just the recordTypeMappings for a few specific Record Types. There are no examples in the AJAX Toolkit documentation of doing this, but it (mostly) works and is documented in the API docs (http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_describelayout.htm) (with different syntax, which is worrying as well).

Here's my basic call --- I get the describeLayout for the Account object, but pass in 3 Record Type Ids:
var result = sforce.connection.describeLayout('Account',["012G0000000jVOmIAM","012G0000000jdgIIAQ","012G0000000jVOhIAM"]);
This returns a valid payload, but what's weird is that it only returns recordTypeMappings for the last 2 Record Types I requested, not 3! If I request 2 Record Types, it returns recordTypeMappings for just the last Record Type I requested! And when I request it for just 1 Record Type, it returns ALL Record Type mappings. 

User-added image

So my question is, is this the way it is supposed to be working? Or is this a bug?
Did you ever figure out what was going on with this?  I think it is a bug.  Prior to version 31.0, it seemed to work as expected.  But starting with version 31.0 (through the current version 34.0), I see that whenever a second argument is provided,

1) just like you said,
        if the list size == 1, recordTypeMappings contains all of the record types
        if the list size > 1, it ignores the first id

2) The layoutId value in the recordTypeMapping is null

3) The result doesn't include any layout information.  (result.layouts is undefined)

This can't really be the way it's supposed to work...  

Also, like you mentioned, the documentation for describeLayout doesn't match (also only from v31.0 and onward).  The documentation lists 3 arguments, but it will only accept 2 (synchronously).  If I include a third, it thinks it's a callback function.