Creating new row in a different model from within a drawer

  • 1
  • Problem
  • Updated 3 years ago
  • In Progress
  • (Edited)
I have two objects Bundles(parent) and Bundles Line Items (children). The Bundle Line Items are showing in a drawer component attached to Bundles. I want to be able to select all of the children and create new rows in a new model (Quote). I have the action set up on the drawer to do this.



The problem is using the Merge Syntax only brings in one row of data (the first row selected). Not all the selected rows. I am using a Merge Syntax because I believe due to this table being in a drawer the context is not that of Bundle Line Items but of Bundles. With that said I have tried connecting through the Bundles with no success. 

If the table is not in a drawer it works fine.

Has anyone else run into this problem?
Photo of Tami Lust

Tami Lust

  • 5,280 Points 5k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
Maybe try a page include in the drawer instead of a table? Build a separate page with just the bundle line items table and get it working with the create new quotes function as you want it. Then on the bundles drawer, add a page include and pass in the ID of the bundle in the Query String and put a URL parameter condition on your line items model to only display records with that bundle ID.
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Certainly can be done, but need to get clearer on your requirements. Can you record a video?
Photo of Tami Lust

Tami Lust

  • 5,280 Points 5k badge 2x thumb
Thanks for the spell check and suggestion, unfortunately it didn't work.

I should have explained earlier that the Item number that I am trying to pull in is from another object connected through the line items (child). So I have been using "Item__r.Id" to get the item number.

When I do what you suggest the "Id" that is being pulled in is the "Id" of the parent not the child or the item. The quantity doesn't fill in at all since there is no "Quantity" field on the parent. 

My original thought process was I need to connect to the child model through merge syntax. However I am only able to pull in the first row not all selected rows.
(Edited)
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
T his for sure can be done, but it needs closer inspection of schema and page. Maybe Rob can delve into it if you grant him access.
Photo of Tami Lust

Tami Lust

  • 5,280 Points 5k badge 2x thumb
Thank you for taking a stab at it.

I can absolutely grant him access. I know it can be done as well I am just lost as to how to connect to the proper model. Hopefully Rob will come in and save the day as usual!

Rob - if your listening I have granted you access. Page name is Quote_Detail. I can discuss offline further if need be.
(Edited)
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Tammy,

What are the context conditions on the drawer? I may be missing something, but I think a mass action on your table on the Bundle Line Items in the drawer should be able to just use short form of merge syntax. Have you tried {{Item__c}} instead of {{Item__r.Id}}?
Photo of Tami Lust

Tami Lust

  • 5,280 Points 5k badge 2x thumb
Matt,

I can't use {{Item__c}} because it doesn't bring in the Id of the item, it brings in the  Item number. So when I try and save the table it throws an error. 

The context of the table is: 
Field (Bundle):Bundle_Name__c
Merge Field (LineItemBundle): Id 

The before load actions:
Empty Model Data: LineItemsBundle
Activate & Set: {{Id}}
Query Model:LineItemsBundle
Photo of Tami Lust

Tami Lust

  • 5,280 Points 5k badge 2x thumb
So I have confirmed that when I hit the mass action button from within the drawer it is looking to the parent model not the child model. Does anyone know how I can change to the child model from within the action, so that when I hit the mass action button it look to the child model?
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Very strange. It should be getting the values from the row in context. So each record should be processed as though it is the row in context. Something is off on this.
Photo of Tami Lust

Tami Lust

  • 5,280 Points 5k badge 2x thumb
This is very strange. I have tried everything I can think of to get the proper data to pull. My last attempt was working with only 1 model thinking that had something to do with it. It didn't it still only sees what parent line.  

The only thing I could get to remotely work was using a merge syntax to pull directly from the line item model. However that only pulls the first line and not all lines in the model.

I am just spinning my wheels at this point... I am out of ideas...
Photo of Tami Lust

Tami Lust

  • 5,280 Points 5k badge 2x thumb
Just to add to the thread a little bit more... 

I removed all conditions that would show a only related list items. I have removed all context settings from the table. So when I open the draw it shows all items in the model. But when I go to mass create new records it still only looks to the parent. 

So I am concluding at this point it seems to be something with the table in the drawer because I have removed all conditions that would tie the children to a parent.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Thanks for all the good work with Tami.  I'm sorry I've been unable to respond for the last day or so.  But I'm back.  

You said you had extended login rights to your org so we ccould take a look.
- Can you make sure those are still active? 
- Can you send email to support@skuidify.com  with the  ORG ID and any specific repro steps that might help in troubleshooting.  If this is a production org - a test record might also be helpful - since it looks like the actions include saving data. 

We'll see what's going on...
Photo of Tami Lust

Tami Lust

  • 5,280 Points 5k badge 2x thumb
Hi Rob,

Thanks for chiming in. I have sent you an email with all the needed info. 

Thank you.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
What Pat said is correct.  The context that is being used to pre-populate data is the parent row from which the drawer is opened, rather than the specific rows inside the drawer.  This is one of those edge case scenarios where “context” gets very tricky. 

At this point I believe there are two options. 

1. Move the table outside the drawer and run the mass action there. 

2. Make the action a Row Action.  Single row action buttons ovewrite the context in memory, whereas multiple row actions create a new object called “context rows” but don’t necessarily overrwite the single “context row”. 

Again context is a complex area. 
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
Rob, couldn't you do a page containing the table of children and put it in the drawer of the parent and pass in the ID of the parent row as a param condition of the page include? That way you would have the right context but still have a global action all within the drawer?
Photo of Tami Lust

Tami Lust

  • 5,280 Points 5k badge 2x thumb
For anyone running into this problem here is a work around. It is set up like a drawer but not in a drawer:

1. Create a table connected to your parent model
2. Create a table connected to your child model
2a. Set a condition to connect to the parent: Default filterable off 
3. Have a "Row Action" show a table connected to your children
(These are the same actions you would set for a drawer)
3a. Activate and Set Value
3b. Query Model (child object)
3c. Save Model (child object)
4. Conditionally set the the child table to only show when the child model has data rows
5. Set your mass action button on the child table
5a. I added another action at the end to empty the child model to ensure it disappears. 

Let me know if you have questions!
  
Photo of Oliver Sinfield

Oliver Sinfield

  • 922 Points 500 badge 2x thumb