Creating new record in a different model from a drawer

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

I have 2 objects Opportunity and Opportunity Lineitem. I am showing the Opportunity line item record in a drawer based on which opportunity is selected.

I have a thrid object called Opportunity Revenue which is related to both Opportunity and Opportunity LIne item. I want to create Opportunity Revenue records when user selects Opportunity Line Items.

Can this be achieved?
Photo of Aveleena

Aveleena

  • 140 Points 100 badge 2x thumb

Posted 3 years ago

  • 1
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Aveleena,

I am assuming that you have a table in your drawer that shows Opportunity Line Items.  Create a model to enter your new Opportunity Revenue record.  Make sure that you have conditions for both the Opportunity lookup and Opportunity Line lookup that are set to Default Off.  You can add a row action that runs multiple actions.  In your action steps activate and set the conditions of the New Opportunity Revenue record with the corresponding values from the Opportunity LIne Item record, then open a pop up window to enter the new Opportunity Revenue record.  That should get you what you want.

Thanks,

Bill
Photo of Aveleena

Aveleena

  • 140 Points 100 badge 2x thumb
Hi Bill,

Thanks for your reply.

The approach that you have suggested needs the users to enter the Opportunity and opportunity line item record in the popup.

What I am looking for is a way in which this can be done dynamically without the users inputs based on the lineitem selection in the drawer it should just pick up the OpportunityID and Lineitem ID and associate it to the new Revenue record.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Bill is right.  If your action sequence starts by setting the opportunity and opportunity line item conditions to what is in context and then creates a row - those values will be pre-populated. 
Photo of Aveleena

Aveleena

  • 140 Points 100 badge 2x thumb
Hi Bill,

I am pretty new to Skuid, it will be really helpful if you can guide me through the step by step process.
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Aveleena,

  1. Add a model to your page to create the NewOpportunityRevenue object.  Leave the options for 'Load Model data on page load' and 'Create default row if Model has none' unchecked.  Also make sure you select the Opportunity and OpportunityLineItem lookup fields in this model.
  2. Click on your OpportunityLineItem model (the one for your drawer) and make sure you have selected the fields for your Opportunity Line Item Id and your Opportunity Id.
  3. Go to your Opportunity Line Item drawer and add a row action. Keep the action type as 'Run multiple actions'.
  4. In the Action steps for this row action, add a step to 'Remove all rows from model' and set it to clear your NewOpportunityRevenue model.  This step ensures that any cancellations of creating a NewOpportunityRevenue don't carry over to another.
  5. Next add a 'Create new row(s)' action for your NewOpportunityRevenue object.
  6. Click on the action step that creates your new row for the NewOpportunityRevenue object.  Click the plus sign to 'Add a default value'.  Set the value field to be your Opportunity Id.
  7.  Add another default value to set the Opportunity Line Item Id.
  8.  Add a final action to 'Show popup'.  This will show the form for the NewOpportunityRevenue object.
Note that in my screenshots I am creating a new task from a row action on the Contact model.  I am setting both the WhoId and WhatId from the ContactId and AccountId respectively.  This is what you will be doing with Opportunity Id and Opportunity Line Item Id.

Thanks,

Bill