Symptom
- If you use the instance sync tool to move over legacy csv picklists, business rules that reference these picklists in the target instance do not make sense, showing incorrect values or numbers that do not show a value for an active picklist.
- The rules referencing a legacy picklist will not work or behave unexpectedly in the target instance.
Environment
Instance sync where both instances are using MDF Business Rules
Cause
- Option IDs are created by the system on upload. There is no way for the instance sync tool or for the user to manually define each picklist Option ID.
- When the instance sync tool syncs MDF Business Rules, there is no way for the tool to “pivot” the source Option IDs to the target Option ID as there is no immutable code in which to reference each value(a use that is exclusive to Option IDs, as External Codes can be repeated globally).
- Thusly, the instance sync tool keeps the Option IDs present in the source instance’s MDF Business Rules, even if they do not reference the desired Option IDs in the target instance.
Resolution
MDF Business Rules that reference legacy csv Picklists need to be manually configured to reference the correct option ID (per KBA 2378577).
The MDF Business Rules are stored in the system as Java code, and can be downloaded, edited, and uploaded to fix these values in the target instance instead of using “Configure Business Rules.”
Below listed is a process to perform the changes to the Rules directly in the code.
- Download Source Instance’s .csvs
a. Log into Source Instance -> Admin Center
b. Import and Export Data -> Export Data -> Object: Rule -> Include dependencies “No”
c. Picklists Management -> Export all picklist(s) -> Submit
- Create Spreadsheet of all Option IDs referenced in Rules
a. Open Rule.csv with a text editor (Such as Notepad++)
b. Find option IDs within the Java Code
i. Find == “” to find option IDs in IF statements
ii. Find = “” to find option IDs in THEN or ELSE statements
iii.
c. Transcribe these Option IDs into second Sheet of picklist.csv (as shown below)
d. Rename Picklist Export Sheet as “SOURCE” (as shown below)
e. Rename Second Sheet containing Option IDs as PIVOT (as shown below)
i.
3.Extract Pivotable Information from Option IDs
a. In Source Sheet
i. Make OptionID column A
ii. Make ^picklistID as column B
iii. Confirm en_US (or default label language) is column I
b. In Pivot Sheet
i. Type in cell B2 formula: =VLOOKUP(A2,SOURCE!$1:$1048576,9,FALSE)
- Explanation of what formula does: Look at the Leftmost Column, find whatever value is in cell A2, look in the entirety of the Source Sheet, Return the 9th column, and look for an exact match
- Extend the formula down to all rows needed
ii. Type in cell C2 formula: =VLOOKUP(A2,SOURCE!$1:$1048576,2,FALSE)
- Explanation of what formula does: Look at the Leftmost Column, find whatever value is in cell A2, look in the entirety of the Source Sheet, Return the 2nd column, and look for an exact match
- Extend the formula down to all rows needed
iii.
4.Match Data from PIVOT to TARGET
a. Download target instances picklistdata.csv
b. Copy entirety of .csv and put it on third sheet, rename it TARGET
i. Make the en_US (or default language) as column A
ii. Make OptionID as column B
iii. Confirm ^picklistId as column C
c. In PIVOT cell D2: =VLOOKUP(B2,TARGET!$1:$1048576,3,FALSE)
d. In PIVOT cell E2: =VLOOKUP(B3,TARGET!$1:$1048576,2,FALSE)
5.Confirm that columns C and D have the same Picklist ID, if they do not, try to cross match Option IDs manually
6. In Target Instance, replace all old Option IDs with correct Option IDs
a. In Target instance
i. Import and Export Data -> Export Data -> Object: Rule -> Dependencies: No
ii. VERY IMPORTANT: SAVE BACKUP OF RULE.CSV FROM TARGET
b. Open Target Instance Rule.csv in text editor
i. Find and Replace Function:
1. Replace all (From PIVOT column A) with (From PIVOT column E)
ii. Save Rule.csv DO NOT OVERWRITE BACKUP RULE.CSV
c. Upload Rule.csv in target instance as full purge
7. Sanity test rules
See Also
Keywords
MDF, Picklist, Business Rules, Instance sync , KBA , LOD-SF-EC , Employee Central , LOD-SF-PLT , Platform Foundational Capabilities , How To