Skip to main content

Hello, I’m trying to use a button to automatically create a record in Salesforce, based on the data on the current page. I don’t want to produce a form for someone to complete, as I already have all the data. My workflow is below:


  1. Button with an action on it. This action shows a pop up, and creates a new model row.


  1. The ‘new model’ row is using merge codes to take data from another mode: e.g. $EPP_Projects.Name (where EPP_Projects is the name of the model, and Name is one of the referenced fields)


  1. The pop up is configured so that on close, the model is saved.

I don’t receive any errors, but there is no data appearing in Salesforce. When I go to close the page, it warns me there is unsaved data.


Any ideas?


Thanks!

I always reverse my actions on my button:

First Create a new row in the model (and set the fields as you have shown)
Then Show pop up

On your pop up, make sure you click each field editor and set the Context to be Id = Id (it is usually there by default, but double check.) I also set my field editors to be in “Edit” mode on the pop up since I expect the user to fill something out.

Now, when merging fields from another model, the syntax looks like this:
{{$Model.EPP_Projects.data.0.Name}}

You can replace Name to be your field’s api name (could be a custom field, like My_field__c.)

Final Step - put a custom Save button on your pop up that saves your EPP_Projects model and closes the pop up.


Hi Chandra,

Thanks for that. The only thing is, I want it to happen in the background. I don’t want the user to have to fill in anything or hit save, as it’s for external users to request information about the page they are on (via community).

Is there a way to do it, without someone having to save?

Laura


ok - sure.  Then just add an action to your button to save.

Button actions:
Create a New Row
Save

What are you using the pop up for?  Just to show the user what they created?


Hi Chandra,

No data in pop up, just a message to say submitted. I don’t really need any action on the pop up, except for it to close again.


Reply