Clear a field on incident when it's state updates to Cancelled
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2024 06:56 AM
Hello All,
I have to clear a field when state of incident is updated to cancelled, please let me which BR is to written as it is not better practise to use current.update() in BRs . Which is the best way of achieving this as per servicenow best practices ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2024 07:12 AM - edited 03-29-2024 07:12 AM
Hi @RC19 ,
You dont need to use current.update() in BR, just mark field emtpy using the curren object.
Only issue i can think of, any mandatory field at DB level may not allow BR to save the current object.
-Thanks,
AshishKM
Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2024 08:24 AM
@RC19 You can easily achieve this via an onSubmit client script, no need to create a business rule for this case.
Here is an example of the onSubmit client script.
function onSubmit() {
var state = g_form.getValue('state');
if (state == '8') { //8 is cancelled
g_form.clearValue('location');//Assuming you need to clear the location field.
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2024 12:16 PM
Hi @RC19 ,
You can write simple onchange client script to clear the value of any field when state change or updated to cancelled,
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (newValue == 8){
g_form.clearValue('company');
}
}
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang