in the 'On Load' i am trying to solve this issue

1__TapasviSinK
Tera Contributor

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');
}

5 ACCEPTED SOLUTIONS

Priyanka0402
Mega Sage
Mega Sage

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

View solution in original post

Bhavya11
Kilo Patron

Hi @1__TapasviSinK 

 

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

View solution in original post

abirakundu23
Mega Sage

Hi @1__TapasviSinK ,

Please follow below code:

abirakundu23_0-1721016225499.png

Please mark helpful & correct answer if it's really worthy for you.

View solution in original post

Satishkumar B
Giga Sage
Giga Sage

Hi @1__TapasviSinK 

 

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!

View solution in original post

Harish Bainsla
Kilo Patron
Kilo Patron

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);
}

View solution in original post

8 REPLIES 8

Satishkumar B
Giga Sage
Giga Sage

Hi @1__TapasviSinK 

 

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!

Harish Bainsla
Kilo Patron
Kilo Patron

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);
}

Community Alums
Not applicable

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

Can you please help me with example from Harish's code.