Before submitting the catalog item i want to see some alert message on top

kranthi2
Tera Expert

Hi,

Before submitting the catalog item i want to see some alert message on top.

I am having a catalog item into that if Category= Undefined - did not find my issue type

                                                                Sub category= Undefined - did not find my issue type

                                                                Issue type= Undefined - did not find my issue type

 

then submit the item i want to show some alert message to the user which is 

"Please check all categories before proceeding if it is undefined."

 

kranthi2_0-1704766844280.png

Alert message should show only category, sub category and issue type is Undefined - did not find my issue type

 

Please help me out on the same.

 

Thanks,

 

 

1 ACCEPTED SOLUTION

DpkSharma
Giga Expert

Hi @kranthi2 
Replace your code with this:

 

function onSubmit() {
var category = g_form.getValue('u_category');
var subCategory = g_form.getValue('u_subcategory');
var issueType = g_form.getValue('u_issue_type');
// Check if any of the fields is undefined
if (category === 'undefined' || subCategory === 'undefined' || issueType === 'undefined') {
// Display alert message
alert("Please check all categories before proceeding if it is undefined.);
return false;
}

return true;
}

Please Mark this as Helpful and Accepted. If this Solves your query
Regards,
Deepak Sharma

View solution in original post

12 REPLIES 12

Harish KM
Kilo Patron
Kilo Patron

Hi @kranthi2

you can create a onSubmit catalog client script.

var getCat = g_form.getValue('category'); // make sure variable names are correct

alert(getCat );//check backend value and match it in if condition

var getSubCat = g_form.getValue('subcategory');

var getIssueType = g_form.getValue('issuetype');

// if cond to check all 3 variables have same value 'undefined'

if(getCat == 'Undefined - did not find my issue type' && getSubCat =='Undefined - did not find my issue type' && getIssueType =='Undefined - did not find my issue type')

{

confirmation = confirm("Your Message");

if (confirmation == true) {
return true;
} else {
return false; // abort submission if user select No
}

}

Regards
Harish

Hi @Harish KM 

Thanks for your response.

 

It is not working as expected. i am getting the sys id as pop up, mentioned in the below screenshots

 

kranthi2_0-1704780507581.png

 

kranthi2_1-1704780578010.png

 

 

kranthi2_2-1704780627741.png

 

please help me out on the same.

 

Thanks,

 

 

 

Hi @kranthi2 what is the variable type for all these 3 variables? If it is reference then you need script include and glideajax call

Regards
Harish

Yes, all the three fields are reference fields only.

could please help me out with the script.

 

Thanks