save child records with a parent, for different recordTypes

I have two objects Parent is “Request” and the “FeedBack” Is the child, 
Child has 3 record types and want to save child records for different recordTypes

In Skuid I have three different models for each recordtype

I want to create 3 child records for each recordtype while saving the parent record.

Tried parent model’s action to save the child objects with updating values of the fields recordTypeId and parentRecordI didn’t work.

Note :  all the child models are there just to create empty rows and not used in Field Editors,
Javascripts etc…




Can someone help me with this please, Thanks in advance

Hasantha,

If you’re only using the child models to create new rows, you should be able to set a condition in each of them for the correct record type, along with a ‘field from another model’ condition tying them to their parent model (Request).

Then you’re on-save action on the Requests model should have three “create new row” actions, one for each model, (and then if you also want to save the new rows you created, a single save models action to save all three).

Does that make sense?

Matt’s right…  As usual… 

Thanks for the reply Matt, It helps me a lot;

I have got another scenario to be covered with dynamically generating the “FeedBackBCC” only for a specific record type otherwise ignore creating record.

To achive this I used a custom java script with createRow() method to create the new record based on the recordtype selected in the parent.

Is this approach valid? or are there any other way of doing this with skuid Actions or Conditions?

Thanks again!

If you want to spin through all records and only create the FeedbackBCC record for partiuclar record types - then I think your custom Javascript is going to be the answer. 

However - if you want the user to have the ability to create the FeedbackBCC record only on particular items - you could control the appearance of that button via conditional rendering.  Then you could use the action sequence to create the new FeedbackBCC record. 

Rob, Thanks for the reply. now this functionality works fine for Admin user, 
I have another problem, I created a custom profile and assigned the “Request” (Master)object Read,Create,Edit,Delete permissions (removed the modify All Data) and creation of child record stopped working with new profile.

NOTE:

  1. To get the recordtype ids I have three efferent models aligned with particular recordtypes.
  2.  Profile is API Enabled and View Setup and Configuration enabled.
  3. If I create a child record with standard SF it works fine.

Could you help me to figure-out the cause here, what am I doing wrong?

Thanks again

Question for you.  What record types does the new profile have access to in the Request object?  Unless yo uspecify otherwize I think they’ll just have the default record type and then you’ll have all sorts of problems. 

Rob, The problem here was with the sharing, Once the master record is created, I assign the ownership of the record to another user, I think since the current user does not have access to the master record anymore, it doesn’t create the child records.

I tested this with assigning the ownership to the same user while creating the master record, and it works fine.

My solution here was, I generated the detail records with an apex trigger and my problem solved.

Thanks for the support, it helped a lot :slight_smile:

Glad you figured it out.  There is great power in the Salesforce security model,  but it also often causes these sorts of unexplained behaviors.