I am trying to use the action framework to create a new record based on an existing record. On a single record basis, this is easy, but I need to do it in mass with a single button push. There would only be maybe a dozen records in the model that the operation would work on, but I need carbon copies of each of the 12 records created as new records in the same or another model. I tried “Adopt Rows”. I can’t seem to find much documentation on it, but from what I can see it seems that if the source record is saved, then it has an Id. If it has an Id, then the Adopt Rows function will merge it with existing rows instead of creating new rows. Is there any way to accomplish what I am trying to do with action framework?
This can be done in a couple steps. First the setup.
- Create a model to adopt the selected rows into. Call it “AdoptRowsModel”.
- Create a model with “Clone Always” and a condition where Id in Id of “AdoptRowsModel”. Call it “CloneModel”.
- Adopt Rows into "AdoptRowsModel"
- Query "CloneModel"
Pat, you are awesome. I haven’t tried this yet, but I will. In the meantime, I came across this post which uses a java snippet. I modified it for my models and the fact that I want to iterate through the source model records for my each statement instead of a third model like contacts. I ran a test and it works, except I would have to map every field I want copied into the new model. Yours sounds much faster, but the following does work as well. http://help.skuidify.com/s/tutorials/m/supercharge-your-ui/l/109496-mass-create-records#!prettyPhoto Thanks for your help.
HA! It worked! Thanks Pat! Never thought to use clone always in a separate model. Nice piece of skuidery!
Yup. The “Clone Always” is quite powerful. You can additionally set a chain of models to clone in same way. Think of an Account with it’s Contacts, Opps, Quotes, Quote Line Items, etc. The whole thing can be duplicated using action framework.
Yes, that is actually what I am doing, but when you clone the children (like contacts) they are cloned with the existing Account. At what point in the action flow do you introduce the change of account on all children contacts? I have tried a couple of things, but can’t get my children to switch parents. I made sure that the master/child relationship is set to reparent.
You should be able to use the method, so long as you query all models in the one query action.
Sorry to be a pain, but what method of updating the parent account would you recommend? 1) model action on the clone always model triggered by requery? 2) a condition on the clone always model set to have the account ID set to the newly cloned account? 3) Other? As always, thanks for the help
I’m not sure I understand. If you set two models,Accounts & AccountContacts, to query with “Clone Always”, then both set of records will clone. The Contacts will be set to the new cloned set of accounts.
Ah, that is where I was missing something. I used a create new on my top level object and then the adopt rows and clone always on the children. I have been unable to get any mid stream changes to stick using update fields on rows. I’ll try cloning the top level ands see if it solves my issue. Thanks!
Finally got back around to this. I added a model action on the clone always model to update fields upon query. This allows me to clone MOST of the original but change a few fields in my clones. Thanks for the help with this! Works great!