How to set Suspend Reason Mandatory and default value?

Peeyush Jaroli
Tera Expert

Dear Community Members,

I have a requirement where I need to make Suspend Reason mandatory which pops up when clicked on suspend case button. How can I do that?

Another requirement is to make a value as default one. For example I have item1 to item 4, I want item 3 to be selected by default.

How can I do that?

 

 

1 ACCEPTED SOLUTION

Hi Peeyush,

I updated in my instance and it now shows Group as default but shows in order correctly

script updated below

<select id="suspend_reason" class="form-control" name="suspend_reason">
	<j:while test='${reasons.next()}'>
		<j:if test="${reasons.getValue('value') == suspension_type}">
			<option value="${reasons.getValue('value')}" selected='selected'>${reasons.getValue('label')}</option>
		</j:if>
		<j:if test="${reasons.getValue('value') != suspension_type}">
			<j:if test="${reasons.getValue('value') == 'group'}">
				<option value="${reasons.getValue('value')}" selected='selected'>${reasons.getValue('label')}</option>
			</j:if>
			<j:if test="${reasons.getValue('value') != 'group'}">
				<option value="${reasons.getValue('value')}">${reasons.getValue('label')}</option>
			</j:if>
		</j:if>
	</j:while>
</select>

find_real_file.png

find_real_file.png

find_real_file.png

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

22 REPLIES 22

Hi Peeyush,

Can you share the script?

from where the reasons are fetched? in my instance it is from sys_choice table and from sla_suspended_reason field

find_real_file.png

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur, 

same as you mentioned, 

in my instance also it is from sys_choice table and from sla_suspended_reason field.

I want to make item 3 to be default but dont want to change the alphabetic order.

Hi Peeyush,

you will have to modify the jelly script?

if you could share complete script here?

so what should be the selected value in your case?

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Peeyush,

I updated in my instance and it now shows Group as default but shows in order correctly

script updated below

<select id="suspend_reason" class="form-control" name="suspend_reason">
	<j:while test='${reasons.next()}'>
		<j:if test="${reasons.getValue('value') == suspension_type}">
			<option value="${reasons.getValue('value')}" selected='selected'>${reasons.getValue('label')}</option>
		</j:if>
		<j:if test="${reasons.getValue('value') != suspension_type}">
			<j:if test="${reasons.getValue('value') == 'group'}">
				<option value="${reasons.getValue('value')}" selected='selected'>${reasons.getValue('label')}</option>
			</j:if>
			<j:if test="${reasons.getValue('value') != 'group'}">
				<option value="${reasons.getValue('value')}">${reasons.getValue('label')}</option>
			</j:if>
		</j:if>
	</j:while>
</select>

find_real_file.png

find_real_file.png

find_real_file.png

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Wonderful Ankur. This solved my problem. Thanks a lot.

 

How you learned all these things? It would have taken full week for me to try and test in order to achieve this default thing in UI page.