How to restore values of a deleted field?

How to restore values of a deleted field?

Hi,
Lets say I'm editing the development environment of an app. The app has a form, I deleted a field named "field1". But in the production environment, there are several records of the form that contains values in the same field. Now in the dev environment, if I add another field with the same display name, same link name and same type as the previously deleted field, and once I publish the app to production, will the values from the deleted field be automatically transfered to the newly added identical field? If no, is there an easy way to do the transfer manually?

One way I can think of is running a custom function that does the transfer.
Here's how to do it:
  1. Before publishing to the prod environment, export the records as a csv.
  2. Open the exported csv file, convert the two columns "ID" and "field1" to key-value pairs with the key being the record ID and values being the field values.
  3. Publish the app to prod environment.
  4. Once published, run a custom function that would take the key-value pairs as input and add the value to the new field against the record ID in the key.
The function would look something like this:
  1. void transferValues(Map pairs)
  2. {
  3.       for each pair in pairs
  4.       {
  5.             rec1 = Add_Form1[ID = pair.key];
  6.             rec1.field1 = pair.value;
  7.       }
If you have done something like this before, please let me know if it works.

    Access your files securely from anywhere

        Zoho Developer Community




                                  Zoho Desk Resources

                                  • Desk Community Learning Series


                                  • Digest


                                  • Functions


                                  • Meetups


                                  • Kbase


                                  • Resources


                                  • Glossary


                                  • Desk Marketplace


                                  • MVP Corner


                                  • Word of the Day



                                      Zoho Marketing Automation


                                              Manage your brands on social media



                                                    Zoho TeamInbox Resources

                                                      Zoho DataPrep Resources



                                                        Zoho CRM Plus Resources

                                                          Zoho Books Resources


                                                            Zoho Subscriptions Resources

                                                              Zoho Projects Resources


                                                                Zoho Sprints Resources


                                                                  Qntrl Resources


                                                                    Zoho Creator Resources



                                                                        Zoho Campaigns Resources


                                                                          Zoho CRM Resources

                                                                          • CRM Community Learning Series

                                                                            CRM Community Learning Series


                                                                          • Kaizen

                                                                            Kaizen

                                                                          • Functions

                                                                            Functions

                                                                          • Meetups

                                                                            Meetups

                                                                          • Kbase

                                                                            Kbase

                                                                          • Resources

                                                                            Resources

                                                                          • Digest

                                                                            Digest

                                                                          • CRM Marketplace

                                                                            CRM Marketplace

                                                                          • MVP Corner

                                                                            MVP Corner





                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now