
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2023 12:40 PM
I am setting up a PDF Document Template.
The required form field is Middle Initial. I have mapped this Form Field to the Subject Person's Middle Name. There is an option to add an Advanced Script.
I am looking for the correct Formula/Syntax/Function to trim the text in the Middle Name field to 1 character.
Any help will be appreciated. I search but have been unable to find anything for how to accomplish this seemingly simple task.
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 09:36 AM
can you try with below script
(function evaluateMappingFieldValue(taskGr /* GlideRecord for parent task */, mappingField /* Pre-computed mapping field value */) {
return ("" +mappingField.charAt(0));
})(taskGr, mappingField);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 10:02 AM
THANK YOU!!!!! That worked perfectly. This solves a host of problems for us. I am so very grateful. Thank you for your time and your expertise.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 09:36 AM
can you try with below script
(function evaluateMappingFieldValue(taskGr /* GlideRecord for parent task */, mappingField /* Pre-computed mapping field value */) {
return ("" +mappingField.charAt(0));
})(taskGr, mappingField);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 10:02 AM
THANK YOU!!!!! That worked perfectly. This solves a host of problems for us. I am so very grateful. Thank you for your time and your expertise.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-07-2023 09:43 AM
I was just giving an example of how you could do it. My code was in no way a cut and paste. Based on what you posted you should have used taskGr. Also if you want to get the first char you need to use zero not one.