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

Hi @kranthi2 These 3 variables referenced to which table? and which field holds this value 'Undefined - did not find my issue type'?

Regards
Harish

Ankur Bawiskar
Tera Patron
Tera Patron

@kranthi2 

the way you get display value for reference field in portal side is different

try this

var categoryValue = g_form.getDisplayValue('u_category');
var subCategoryValue = g_form.getDisplayValue('u_subcategory');
var issueTypeValue = g_form.getDisplayValue('u_issue_type');

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

@Ankur Bawiskar 

Thanks for the response Ankur,

Just want to ask you could you please include all the complete script.

 

Thanks,

@kranthi2 

I shared sample script above

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

@Ankur Bawiskar 

please find the below SS:

 

kranthi2_0-1704783427052.png

 

kranthi2_1-1704783517017.png

 

I want to see the yellow highlighted line.

 

Thanks,