githubbob42 / mingle2github2

0 stars 1 forks source link

Enhance Mobile to honor the Record Type specific Picklist defaults #2216

Closed githubbob42 closed 9 years ago

githubbob42 commented 9 years ago

Mingle Card: 2460 Steps to reproduce

| | |
|-|-|
|**Version #**|
|2268|
|**OS**|
|\*|
|**Browser**|
|\*|
|**Username**|
|SA: tparigi@38demo.com           Field: bobfield@38demo.com|
|**Password**|
|SA: computer#800                Field: computer#700|
  1. Start a new Job in Mobile
  2. Select the Wireline record type when creating the new Job
  3. Notice the Segment picklist.   There are 3 selections in there and no default picklist value is auto-selected for the user.
  4. In SFDC on the config side of things, that record type Wireline at the Job__c level has been configured to only show 2 picklist values with a default of Reservoir Evaluation.  However in Mobile, the default picklist value isn't honored and the picklist is showing all 3 selections.  We should make Mobile's picklist operate like the SFDC picklists operate with respect to default and filtering.  

This card is related to #1839

Expected result

We never built in support to Mobile such that the default Picklist value is set based on the chosen record type.  Several customers are asking for this functionality as they need it to simply and expedite data entry.  In addition, supporting this functionality will bring our Mobile product into closer alignment with the way record types and picklist values operate in SFDC Back Office.

Analysis

The picklist default values per record type are not returned in the describe call but in the describe layout call (because record types define the layouts).  Unfortunately we are not looking for this information here and throwing it away.

Note that the describeLayout results contains (what appears to be) a complete copy of the describe results for each field in the layout with any specific record type customizations to it.

Also note, that in addition to the default value changing per record type, the list of available values can also change per record type.

Options:

UPDATE: After talking over with Craig, this really should be a story card in itself as it is a feature of record types that we have never supported and the extent of the implementation would be rather involved.

Based on the fact that the describe layout call contains a copy of the describe result (metadata) for each field, Craig thought it would be worth investigating whether we could eliminate the initial describe call altogether.  I mentioned this to Yusuke and he think that is not possible as we need the full objects metadata to sync down all of the fields (mainly for calculations - any other reasons? references/lookups? search layouts?).  

However, we could use the full metadata just for syncing down data and then only retrieve (from IndexedDb) the layout (w/ metadata included) for form rendering, etc.  That would reduce the calls to the IndexedDb database as well as the filtering (field associating) between metadata and layout when building up a form, etc.

Additional thoughts:

UPDATE (2/6/2015): currently the REST API (I tested on both v29 and v32) does not support retrieving recordType specific info regarding picklists (neither recordtype specific picklist values or default picklist value per record type), both of which are pertinent to this card.

UPDATE (3/17/2015)

Apparently Salesforce provides the picklist value information for recordtypes as part of the layout results and not the actual describe results.

According to DP, we'll need to update the Layout sync process to pull the picklist information and store it as part of the layout in the store.  Then we'll need to update the binding to read from the layout for the picklist values.

To see the picklist recordtype value information, you can use the Workbench, REST Explorer and do a describe on an object with a picklist with record type dependent values.  Eg.

/services/data/v32.0/sobjects/FX5__Ticket_Item__c/describe/layouts

Then pick a record type, open the "url" folder and navigate to the url, click on "show raw response" and search for the string picklistValues" : [ { 

Related Cards

Test Plan

Bob is writing the selenium tests (June 8)

            Model factory test cases updated to test this scenario

    Had a discussion with andy about how this can affect customers that rely on defaults set via the picklist field on the object vs. those configured on the picklist field via record type layout

            For now look at test plan (Test plan is on card #1839 as both are very similar)

            Test Case: Filter picklist by record type

githubbob42 commented 9 years ago

Pull Request #1493