Skip to main content

Hi there - I’m trying to default a text for a field. Scenario is that I have a button that is opening a popup to enter notes. I want to default the comments, subject, etc. I have 4 “notes” buttons, but each of the 4 buttons will have different default text. So, button 1 subject says button 1, button 2 subject says button 2, and so forth. I’m trying to not have to create 4 different models with all the same functionality with exception of the default text. Does anyone have away around this without any JavaScript?

Have your button run multiple actions: 1) create a new row once you have selected this action, you will see a little plus sign on the action. Click it. It will allow you to pre populate fields with certain values 2) open pop up


Thank you! I knew that was somewhere but I just couldn’t find it. One more question - in my default text, I want to have it show on 2 different lines (I want to enter a page break). Have you done this before?


The field would have to be a text area or rich text. Still, I’m not sure this would work. What you probably want is to have one field represent your first line and a second field represent your second line. Then display both fields together in a template field. The template field can be laid out however you want and merges in the values from the regular salesforce fields.


I did a page break (in a text area) …never could get it to work in the declarative actions, and ended up doing it in a snippet.  This was just used in a demo and I never fully tested it in a bunch of browser versions.  But essentially the comment string became:

newComment = commentLine1 + ‘/n’ + commentLine2;

and the /n produced a carriage return.

So you could run a snippet before showing your pop up that added the break, something like this: (replace CommentModel and Comments__c with your actual model and field)

var params = argumentsr0],$ = skuid.$;
   
var myModel = skuid.model.getModel(‘CommentModel’);

var myRow = myModel.getFirstRow();

var commentLine1 = “First Line of Comments”;
var commentLine2 = “Second Line of Comments”;

myComments = commentLine1 +  ’

’ + commentLine2;

                
myModel.updateRow(myRow,{Comments__c: myComments});