Default Text in a field

Ryan FaustRyan Faust Member
edited October 2019 in Questions
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?

Comments

  • edited October 2019
    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
  • Ryan FaustRyan Faust Member
    edited February 2017
    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?
  • edited February 2017
    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.
  • Chandra VChandra V Member
    edited February 2017
    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 = arguments[0],$ = 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});
Sign In or Register to comment.