BrianC1

Commodore
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-09-30
09:54
3283 views
Before we 'close' an item we would like to have any blank/empty text fields automatically filled in with "N/A" or similar text. I feel like somewhere I saw the code for a script on how to do that, but maybe I'm imagining that. I did find a script for hiding blank fields on a form, but we would rather have those fields filled in.
I could maybe create a special form for this and use form actions to do it, but we have several text fields. Any guidance on how to fill in all blank fields at once would be appreciated.
Thanks!
-Brian
I could maybe create a special form for this and use form actions to do it, but we have several text fields. Any guidance on how to fill in all blank fields at once would be appreciated.
Thanks!
-Brian
1 Solution
Accepted Solutions
jmalin

Absent Member.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-10-01
02:18
If you just want one universal form action, this code executed "When the form is about to be submitted..." using "Execute custom JavaScript" should fit the bill:
for (var i = 0; i < aFieldLookup.Fields.length; i++)
{
if (aFieldLookup.Fields.type == "text" && IsFieldEmpty(aFieldLookup.Fields.dbName)){
SetFieldValue(aFieldLookup.Fields.dbName, "n/a");
}
}
3 Replies
Garry Womack MF PS

Micro Focus Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-09-30
10:04
If you are trying to avoid coding for each text field individually and trying to avoid Form actions, an AppScript applied to the post transition context of your Close transition would be at least one way of achieving your goal. The logic could dynamically query for all text fields available on the transition or in the table, inspect to see if it has a value, then set the field to "N/A" if applicable. It shouldn't take much code to achieve this. I personally have not seen an existing script to do this however.
jmalin

Absent Member.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-10-01
02:18
If you just want one universal form action, this code executed "When the form is about to be submitted..." using "Execute custom JavaScript" should fit the bill:
for (var i = 0; i < aFieldLookup.Fields.length; i++)
{
if (aFieldLookup.Fields.type == "text" && IsFieldEmpty(aFieldLookup.Fields.dbName)){
SetFieldValue(aFieldLookup.Fields.dbName, "n/a");
}
}
BrianC1

Commodore
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-10-02
09:24
Thanks Gary and Jeff. I set up a rule that checks to see if any of those text fields are blank and made that rule the condition used by the form action. The code Jeff supplied works great.
Thanks again!
Thanks again!