I have a list of dictionaries that need to be filled. It has a top level identifier for the Customer Service Case Number. I have another list of dictionaries that has all the email information related to the case - these dictionaries also have the case number that the emails are related to.
I am trying to break up the email list and associate them in the first list of cases.
I am pulling the information using the Simple Salesforce Package.
#First dictionary:
Cases =
[{CaseNumber : "1",
Date: "value",
Reason: "value",
Emails: NONE (need to add here)},
{CaseNumber : "2",
Date: "value",
Reason: "value",
Emails: NONE (need to add here)}]
#etc. this list is a set of dictionaries of all the cases related to an order #number that is passed in previously.
#The second list of is a list of all of the emails related to the above cases -
Emails =
[{CaseNumber : "1",
Date: "value",
EmailBody: "value",},
{CaseNumber : "1",
Date: "value",
EmailBody: "value",},
{CaseNumber : "2",
Date: "value",
EmailBody: "value",}]
#So this list needs to get nested accordingly to the Emails key by matching on case number
Cases =
[{CaseNumber : "1",
Date: "value",
Reason: "value",
Emails: emails[1,2,etc]},
{CaseNumber : "2",
Date: "value",
Reason: "value",
Emails: emails[3,4,etc]}]
Should create a list of nested dictionaries that are related to the top level case Id.