function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bc2000bc2000 

Inputting data into two custom objects from the same tab

I have two related custom objects in a one to many relationship.  I enter the basic data for the main object, then use the related lists area to make one or more of the secondary objects, and enter data into them.  I'd like to be able (if possible) to enter this data at the same time from the main object tab, without having to go to the secondary object page.  I wouldn't need the ability to create an infinite amount of the secondary objects from the main object page, just maybe 3 or so.  Then if more were necessary, one could use the "new" button on the related lists area, like I'm doing now.

If there is a way to do this, or a way to create multiple lines within an object without having to create new fields for each one, I'd greatly appreciate any and all help.

Thank you very much,

BC
MyGodItsColdMyGodItsCold
I'm not sure I understand what you're attempting, so I'll 'guess'.

Supose you have 'Order' and 'LineItems' as your objects.

On the Order page, you'd have a place where you could add (for example) 3 new line items
(e.g. New1FieldA, New1FieldB, ... New2FieldA, ... New3FieldB, ...).

Then, I'd write an 'after insert, after update' trigger on Order which did 2 things:
1. Used the data from New1FieldA, ... etc. to create new LineItems objects;
2. Cleared the values from New1FieldA, ... etc.

Then, when you'd click Save, the LineItems would be created (and hence visible on
your Related List view), and the 'new data' fields would be cleared, waiting for new data.

Does this help?
bc2000bc2000
MyGodItsCold,

Very good 'guess,' that's what I'm trying to do.

I guess my only problem with that solution is that I'd prefer not to have multiple custom fields for each entry I want to make, but I think it would get the trick done!

You'd have to be careful though, I think with a system like that entering any new data into the New1FieldA would then cause the trigger to overwrite what you had put in originally, instead of making a completely new line entry.  So once you had done the initial entry, you'd have a large number of empty custom fields just sitting there taking up space.  Or maybe there's a way around that?

Thank you for the help, I really appreciate it!

BC