Create a related record

  • 1
  • Question
  • Updated 2 years ago
  • Answered
Hi,

I was wondering if anyone can help me with this question please.

I have a custom object with master detail relationship with Opportunities.

I would like to create multiple related records for that custom object when I create the opporunity on the same page. Also display a set number of records depending on the opportunity field.

For example when I select the opportunity type = silver then the page needs to display 5 records (rows) of the custom object that need to be filled in and saved.

Can you please guide me to the steps.

Thanks,
Photo of Ramtin Sohrabian

Ramtin Sohrabian

  • 220 Points 100 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
You can technically do this all in the ui with multiple buttons and conditional rendering.
Or you can use javascript.

If you want to stay in the world of point&click, create one button for each set of rows that you need to create, conditionally rendering those buttons based on the opportunity type field. The buttons will be run mulitple actions, and will have consecutive 'create new row' actions.

For example, your silver type, your button will have 5 create row actions.

If your gold type needs 7 rows, the button conditionally rendered when the type is 'gold' will have 7 createrow actions.

Will that serve your use case?
Photo of Ramtin Sohrabian

Ramtin Sohrabian

  • 220 Points 100 badge 2x thumb
Thank you Matt! This sounds great.
I was wondering if you can help me with the next question too.
When I try to save my records for the child object it keeps throwing an error that the ID for the parent does not exist. I am pretty sure this is very simple issue and I have read this article: http://help.skuid.com/m/getting-started/l/102641-build-a-custom-create-new-record-page
But I still can't figure it out.
Thanks for your help.
Photo of Ramtin Sohrabian

Ramtin Sohrabian

  • 220 Points 100 badge 2x thumb
Hi Matt,

I worked them out. I am now testing the end to end process.

I may come back with some more questions, if you don't mind.

Thanks for your help!