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,

Did you accidentally mark some other answer as correct?

Please remember to mark relevant reply as "helpful" or being the "correct answer".

Regards
Ankur

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

Hi Ankur,

I marked both the answers as correct because there are two part in my question, one is to set reason as mandatory and another one is to make value default.

But I think it took only one as correct answer. Can we mark two answers as correct here?

Hi Peeyush,

nope; only 1 you can mark as correct.

you can mark the appropriate reply as correct answer.

Regards
Ankur

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

Hi,

If you wanted to add the value for "Reason" in the work notes in what script would that be done? Currently, only the work notes entered in the dialog box show up on the record but I'd like to add the value for "Reason" also. 

Hi Ankur,

In HR form, we are using Suspend UI action and OOB we are getting Reason & Work Notes field in the dialog box. Now, we would like to make Due Date field as mandatory in the form when Suspend Reason dialog box change gets saved?

I think making a field mandatory when the control is in dialog box would be quite tricky. However, I think I should include Due Date too in the Suspend Dialog Box and make it mandatory and after filling the value should be displayed in the Due Date field in the form.

Could you please help or guide me to achieve this?

Quick reply would be much appreciated.