+ Start a Discussion
Rakin MohammedRakin Mohammed 

How to retrieve multi-picklist data in case creation, and how to export it to csv

Hi guys. I have a custom case object that prompts users upon creating a new case to select options from a picklist. Depending on which option is picked, the dependent sub-category picklist is then shown. Followed by a third sub-category. I need to be able to retrieve the different options and their succeeding choices in an excel sheet, with the dependent data all on the same row. I use the Python requests library to create a session with the Salesforce server and extract information from the page css. I also have the API names of the three picklists. Could anyone point me in the right direction to pull the picklist and push to csv file.  
Best Answer chosen by Rakin Mohammed
Vishwajeet kumarVishwajeet kumar
Hello,
Try this blog (https://salesforceprofs.com/how-to-get-dependent-picklist-values-in-apex/) it explains how to get dependent picklist values in apex, in your case you can apply it twice for both dependent fields and merge the results after getting data for both fields.
Apex can only be used inside salesforce so you can create Apex Rest Resource(@restResource annotation) inside salesforce which can implement above process/method and call it using rest api from external phython code to get the picklist options data.

Thanks

All Answers

Vishwajeet kumarVishwajeet kumar
Hello,
Try this blog (https://salesforceprofs.com/how-to-get-dependent-picklist-values-in-apex/) it explains how to get dependent picklist values in apex, in your case you can apply it twice for both dependent fields and merge the results after getting data for both fields.
Apex can only be used inside salesforce so you can create Apex Rest Resource(@restResource annotation) inside salesforce which can implement above process/method and call it using rest api from external phython code to get the picklist options data.

Thanks
This was selected as the best answer
Rakin MohammedRakin Mohammed
Hi, I found the link you sent me very useful. I am actually writing some code similar to this using the JSON strings in validFor. However, I was wondering if you could elaborate on the Apex Rest Resource? Thanks!
Vishwajeet kumarVishwajeet kumar
Hello,
Apex Rest Resource is way to expose code/logic to external systems from salesforce, which can be called using Rest Api. Checkout this link (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_rest_resource.htm) for more details.

Thanks