What's the best way to convert production data into a re

Posted by Rollbase User on 10-Jan-2013 16:16

I've got an a "Consulting Engagement" object with field called "Lead Consultant" and another "Backup Consultant". Both consultant fields were just "text" and stored a userid. On my Development server, I just now created a "Consultant" object and two new 1:1 relationships for lead/backup. My problem is the production system has hundreds of engagements with consultant data and I need the best way convert to these new relationships and remove the old fields.

All Replies

Posted by Admin on 10-Jan-2013 16:21

Here is my proposed solution -- is it good?



1) Rename the old fields to something to make it clear they are old

2) Update all pages to use the new Object lookups and remove the old fields.

3) Write an object script trigger(?) that will create new relationships based on the old field values

4) Deploy the updated application to production

5) Run the Trigger/Script

6) Remove the old fields on DEV

7) Deploy the updated application to production



Is that the best way? Am I missing anything?



Which trigger type should I use? I see "Attach Related Record" as an option.



What should I do if a text value isn't valid? (ex. userid does not exist in the Consultant objects) Is there a way to log and/or get a report from a trigger for these cases?



Posted by Admin on 10-Jan-2013 21:35

Tim,



Your proposed solution is exactly the overall approach I would have suggested. I would use an Object Script trigger rather than an "Attach Related Record" trigger.



Regarding logging you may want to create a text area field for this purpose and write into it in your object script trigger, under the assumption that you'll delete the field once it is no longer needed.



Hope this helps,

Matt

Posted by Admin on 10-Jan-2013 21:51

Thanks for the feedback, Matt!

For a better understanding and future reference, what's a scenario where "Attach Related Record" would be preferred, and why not here?

Posted by Admin on 23-Jan-2013 12:05

Thanks for the feedback, Matt!

Posted by Admin on 23-Jan-2013 21:43

I wrote the trigger, but I'm a bit puzzled on how I can run it against all of my Engagement objects. How would I do that?

Posted by Admin on 24-Jan-2013 08:50

I found a way! I created a new Workflow Action that only runs a trigger, but does not change status. Good solution?

Posted by Admin on 24-Jan-2013 11:32

2013-Jan-24 10:29 : I found a better way! (not mentioned in the RiA book)



When viewing the Object Definition, there is a "More Actions..." and in there is a "Run Triggers" option which leads you to a screen to pick which triggers you want to run on ALL RECORDS.



Posted by Admin on 24-Jan-2013 11:40

FYI for others reading this...and/or updates to the manual:



The button to run the triggers is "Save", which sounds more weird than something like "Run Run Run!", or "Do eeet!", or perhaps a dynamic button that says "Run N triggers on Y objects!".



There is no confirmation screen, just a success header mesg saying the activity was added to the background processing queue and an email will be sent when it finishes.



Bummer that email can't have the log of results generated from the trigger(s).



Posted by Admin on 24-Jan-2013 11:44

Glad you found this. Meanwhile your improvement suggestions here make perfect sense, we'll add them to the queue. Thanks for the feedback



Matt

Posted by Admin on 24-Jan-2013 11:48

Also in reviewing your original post I apologize for not suggesting the "Run Triggers" option earlier -- could have saved you some research time.



Matt

This thread is closed