How do I create a related record from a reusable element popup?

Hi everyone, I just had a question about reusable elements that is confusing me. For example purposes, say I have the following pages:

  • Company_Details
  • Opportunity_Details
  • Lead_Details

I want to have a popup that lets the user create a Follow-Up record which is related to one of these records. Today I do this by having a popup on each of these pages, that has input boxes to capture the required data, and then when the user presses Save, it creates a Follow-Up, setting “Company” to “Current Page’s Company” and so on.

I want to instead do this as a reusable element as it’s a pain having to change it in 3 places every time I need to modify something. I right clicked on the popup and said convert to reusable element, and I was able to add that new follow-up reusable element popup to each page.

Where I’m confused though is how do I then reference the page it came from to save the record? So for example, I have a button on the Company_Details page that is set to open the new_follow_up reusable element. However under the Save button workflow, I don’t know how to complete the Company = field, same with if I’m on the Opportunity_Details page, I don’t know how to complete the Opportunity = field, since I can no longer just pick “Company = Current Page’s Opportunity.”

I tried doing a Workflow with step 1 “Show new_follow_up” and step 2 “display data in new_follow_up” but under data to display everything I pick (like current page’s company) gives a red error so bit stuck here.

You would need to use custom states…if you are not familiar with them, I highly recommend getting familiar with them as they are very useful.

Basically on the reusable element you should have three custom states ( one for each data type you are using it for ). So you could have a custom state on the RE that is company_details with datatype of company from your database.

When you use the workflow to open the popup to send the details to it, you should also set the state, referencing the company as the value. Then when you do your save workflow from the RE you can use the RE custom state value for the company.

company = reusable popup custom state company

Thanks SO much! I definitely do use states but where I was going wrong when using them is I’d always just make it be text for the value, thinking I was supposed to use it like a variable where I save the unique ID or whatnot to it. I didn’t even clue in that I could just set the state to be the datatype of company, or whatever related record, so this will work great!