How to remove default value 0.00 from the price field ?

Community Alums
Not applicable

Hi,

I need help to remove  the default 0.00 from the below field. Please give your suggestions.

Thanks

find_real_file.png

4 REPLIES 4

Ankur Swami
Tera Guru

Hi Prachi,

 

Can you please explain what is the business need for doing this?

Jaspal Singh
Mega Patron
Mega Patron

Hi Prachi,

 

There seems to be some OOB restrictions for Currency field. Find link for workaround.

Musab Rasheed
Tera Sage
Tera Sage

Hello,

you can go to dictionary of field and change accordingly like below but it is not best practice to change default value of OOB field, In case you need some price to be displayed by default for particular item then add the same in particular item as shown in another screenshot.

 

find_real_file.png

 

 

Add price

 

find_real_file.png

Please hit like and mark my response as correct if that helps
Regards,
Musab

shloke04
Kilo Patron

Hi,

You can't make a currency field mandatory directly and you can't set an empty default value.  You can do a couple of things though...

1)  Change the field to a decimal field where you can make it mandatory and empty by default.

or...

2)  Use an 'onSubmit' client script to perform the mandatory validation.  I think this is the best option.  Here's a client script you could use.  Just replace 'u_amount' with the name of your currency field...

function onSubmit() {
	// Make sure 'Amount' is not zero
	if (parseFloat(g_form.getValue('u_amount').split(';')[1]) <= 0) {
		g_form.addErrorMessage("Please enter an amount greater than zero in the 'Amount' field.");
		g_form.setMandatory('u_amount', true);
		return false;
	}
}

This response is mentioned by Mark in article below, please have a look and see if this helps.

https://community.servicenow.com/community?id=community_question&sys_id=0a948623db60af8023f4a345ca9619d2

Also can you post your exact requirement on what are you trying to achieve, may be there can be a better option to handle this and help you further.

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke