- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2024 10:36 AM
When the Page is Loaded,Display the state value on the alert box and short description as (Incident number + category +channel)
function onLoad() {
alert('The state is' + g_form.getValue('state'));
g_form.setValue('short_description','number');
}
alert('The state is' + g_form.getValue('state'));
g_form.setValue('short_description','number');
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2024 08:35 PM
Hello @1__TapasviSinK
Try using below script:
function onLoad() {
var state = g_form.getValue('state');
var incidentNumber = g_form.getValue('number');
var category = g_form.getValue('category');
var channel = g_form.getValue('channel');
// Display the state value in an alert box
alert('The state is ' + state);
// Set the short description
var shortDescription = incidentNumber + ' ' + category + ' ' + channel;
g_form.setValue('short_description', shortDescription);
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards
Priyanka
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2024 08:52 PM
Try this code, hope this will help you
alert('The state is' + g_form.getValue('state'));
var short = g_form.getValue('short_description');
var num = g_form.getValue('number');
var cat = g_form.getValue('category');
var contact_type = g_form.getValue('contact_type');
short = short + ' Incident number: ' + num + ' channel: ' + contact_type + ' category: ' + cat;// The + operator can be used between strings to combine them. This is called concatenation
g_form.setValue('short_description', short);
If my response proves useful, please indicate its helpfulness by selecting "Accept as Solution" and " Helpful."
Thanks,
BK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2024 09:05 PM
Hi @1__TapasviSinK ,
Please follow below code:
Please mark helpful & correct answer if it's really worthy for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2024 09:12 PM
check this:
function onLoad() {
var state = g_form.getValue('state');
var incidentNumber = g_form.getValue('number');
var category = g_form.getValue('category');
var channel = g_form.getValue('channel');
alert('The state is ' + state);
//short description
var shortDescription = incidentNumber + ' ' + category + ' ' + channel;
g_form.setValue('short_description', shortDescription);
}
———————————————-
Please consider marking my reply as Helpful👍 and/or Accept Solution☑️✅, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2024 09:14 PM
Hi @1__TapasviSinK check below code
function onLoad() {
var state = g_form.getValue('state');
var incidentNumber = g_form.getValue('number');
var category = g_form.getValue('category');
var channel = g_form.getValue('channel');
alert('The state is ' + state);
g_form.setValue('short_description', incidentNumber + ' ' + category + ' ' + channel);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2024 09:12 PM
check this:
function onLoad() {
var state = g_form.getValue('state');
var incidentNumber = g_form.getValue('number');
var category = g_form.getValue('category');
var channel = g_form.getValue('channel');
alert('The state is ' + state);
//short description
var shortDescription = incidentNumber + ' ' + category + ' ' + channel;
g_form.setValue('short_description', shortDescription);
}
———————————————-
Please consider marking my reply as Helpful👍 and/or Accept Solution☑️✅, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2024 09:14 PM
Hi @1__TapasviSinK check below code
function onLoad() {
var state = g_form.getValue('state');
var incidentNumber = g_form.getValue('number');
var category = g_form.getValue('category');
var channel = g_form.getValue('channel');
alert('The state is ' + state);
g_form.setValue('short_description', incidentNumber + ' ' + category + ' ' + channel);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2024 09:19 PM
Hello @1__TapasviSinK ,
Above code works fine, but for better performance, check wheather the form new record or not using g_form.isNewRecord()
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2024 11:26 AM
Can you please help me with example from Harish's code.