Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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,

 

Follow link & replace yourisntancename in the URL & change the sequence for the choices.

Set the sequence B as 0(default), while A, C, D can have 1,2 & 3 respectively.

In my case, User is last alphabetically but appears as default value because of sequence.

find_real_file.png

Hi jaspal,

But then User will always come at first place. What I want is User remain at the last in the list but shown up as default.

For example, below Phone is 2nd on the list but I have set it up as default: This is just for illustration purpose. I want that item remain in the alphabetic order but still show up as default

find_real_file.png

sowmya29
Tera Contributor

Supend Dialog box have choices selected, which i'm carry to suspended reason field but it takes only default value it didnt taking the other choices