onSubmit script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2024 12:46 AM
Hi All,
Im trying to populate one field by taking the values of the 4 other fields and to combine it into one value (for the title field). the 'getValue()' however retrieves the values which are not the format I d like to use and GetDisplayValue() method does not work. Any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2024 01:45 AM - edited 08-07-2024 01:46 AM
Hi @dev_K
try this:
function onSubmit() {
var release = g_form.getDisplayValue('release');
var environment = g_form.getValue('environment');
var sourceType = g_form.getDisplayValue('source_type');
var targetType = g_form.getDisplayValue('target_type');
var title = release + ' - ' + environment + ' - ' + sourceType + ' - ' + targetType;
g_form.setValue('title', title);
return true;
}
…………………………………………........................................................................................
Mark it helpful 👍and Accept Solution ✅!! If this helps you to understand.
…………………………………………........................................................................................
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2024 04:34 AM
This does not work, seems getDisplayVlue() is not even available
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-07-2024 01:47 AM
why to do this in onSubmit?
if this is for table then you can use before insert/update BR and handle this
If this is for catalog item then you can handle this once REQ and RITM is generated either in workflow run script or flow designer action
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader