Task shouldn't close without an attachment

Avee90
Tera Contributor

Hello Folks,

    I've a requirement to restrict a user to close a particular SC task without attachment. I've catalog item, it will generation a 10 SC task, my requirement is to restrict task assignee to close that particular task(which has using short description) without an attachment. For this I've tried On submit catalog client script and also a business rule. For business rule it showing the error message but after the closing the task only. It should not be like I should restrict the assignee to close the task without an attachment. I'm attaching the Business rule condition and script. please help me on this.

Thanks,
Naveen. 

3 REPLIES 3

Community Alums
Not applicable

Hi @Avee90 

 

You can check this link for your problem 

https://www.basicoservicenowlearning.in/2020/10/attachment-mandatory.html

 

Please mark helpful and mark as correct if it helps you

 

Thanks and Regards 

Sarthak

Hello Sarthak,

  Thanks for responding. This is for catalog item form for not sc task.

Thanks,
Naveen

Community Alums
Not applicable

Hi @Avee90 

 

Please check the below script 

 

 

 

function onSubmit() {
	var getCount = getSCAttachmentCount();
	if(g_form.getValue('field name') == 'yes'){
		if(getCount <= 0) {
			alert('Attachment is not empty.');
			g_form.addErrorMessage('Attachment is not empty.');
			return false;
		}
	}
}