The Zurich release has arrived! Interested in new features and functionalities? Click here for more

onSubmit script

dev_K
Tera Contributor

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?

 

 

dev_K_0-1723016723677.png

 

7 REPLIES 7

Satishkumar B
Giga Sage
Giga Sage

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.

…………………………………………........................................................................................

This does not work, seems getDisplayVlue() is not even available

Ankur Bawiskar
Tera Patron
Tera Patron

@dev_K 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader