Tip: Add to forms a courtesy display of the record's Created/Modified user & date

Tip: Add to forms a courtesy display of the record's Created/Modified user & date

Sometimes it is helpful, when on a Form, to know the AddedBy or last ModifiedBy user and date.  (Without having to open the record summary or a view that has these columns.) 

Example:


Simply create one function, and then for each form desired, add an Add Note field, and 1 line to OnEdit/OnLoad (takes about 1 minute per form :-)

Function:  Input is 4 params for created/edited by/date, output is a string containing an <hr> plus HTML table with the data.  You can modify the HTML to your liking and since it is a function, modifying it affects all forms on which it is used.
  1. string FUNCS.created_edited(string added, date added_dt, string mod, date mod_dt)
  2. {
  3.     res = "<hr><table cellpadding='1' cellspacing='0' border='0' bgcolor='#eeeeee' style='font-size: 8pt;'><tbody>";
  4.     res = res + "<tr><td><i>Created:</i></td><td>&nbsp;&nbsp;&nbsp;</td><td>" + input.added + "</td><td>&nbsp;&nbsp;&nbsp;</td><td>" + input.added_dt + "</td></tr>";
  5.     res = res + "<tr><td><i>Edited:</i></td><td>&nbsp;&nbsp;&nbsp;</td><td>" + input.mod + "</td><td>&nbsp;&nbsp;&nbsp;</td><td>" + input.mod_dt + "</td></tr>";
  6.     res = res + "</tbody></table>";
  7.     return res;
  8. }

In the desired form(s):
  1. place an "Add Note" field where you want the display to be, perhaps the bottom of the form.  I name mine "created_edited_txt".  The default text that you define for the field can be anything you want, perhaps simply an <hr>, since this text will only show when adding a new record.  ie, when *editing* a record, the table with data will show instead.

  2. In the form workflow OnEdit / OnLoad, add the line below.  (Make changes if you used a different function namespace, or different name for your Add Note field.)  As you can see, this will replace the default text for the "Add Note" field with the output of the function, which will be the HTML table with the created/edited data.
  1. input.created_edited_txt = thisapp.FUNCS.created_edited(input.Added_User, input.Added_Time, input.Modified_User, Modified_Time);
(This could instead have used a multiline text field, but IMO "add note" field type looks better if for no other reason it does not display its fieldname.  A downside of the Add Note field type is that it can't be defined to be seen by "Admin Only" vs. "Everyone".)

You could add other info such as the record's ID, such as to make it a bit easier for users in cases where they sometimes need to learn the ID of a record.

And, deluge-adjusted "add note" fields can also be used for other helpful things on a form, including dynamic clickable links.  Such as the post here .

Suggestions/improvements welcome!