We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

when the page is loaded display the short description as incident number+catgory+channel in onload

prasadservi
Giga Contributor
 
5 REPLIES 5

Dr Atul G- LNG
Tera Patron

Hi @prasadservi 

 

You can write a code like this

 

function onLoad() {
// Get the short description from the form
var shortDesc = g_form.getValue('short_description');

g_form.showInfoMessage("Short Description: " + shortDesc);
}

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG

****************************************************************************************************************

Sandeep Rajput
Tera Patron

@prasadservi Here is the script.

 

function onLoad() {
    // Ensure the fields are available
    var number = g_form.getValue('number');
    var category = g_form.getValue('category');
    var channel = g_form.getValue('contact_type'); 

    // Combine fields into one string
    var shortDesc = number + ' - ' + category + ' - ' + channel;

    // Set the short_description field
    g_form.setValue('short_description', shortDesc);
}

@prasadservi Thanks for the upvote, please mark the response an accepted solution if it addressed your question.

J Siva
Kilo Patron

Hi @prasadservi 

Try the below script.

Note: The short description value will be updated only on the client side. Make sure to save /update the record if you want to update the short description in the database.

function onLoad() {
    var number = g_form.getValue('number');
    var category = g_form.getDisplayValue('category');
    var contact_type = g_form.getDisplayValue('contact_type'); 

    var shortDescription = number + ' - ' + category + ' - ' + contact_type;

    g_form.setValue('short_description', shortDescription);
}​

 Regards,

Siva