Attach a file in Catalog Item as attachment and alert while submit

SNOW46
Tera Contributor

Hi All,

I want to attach one Excel Sheet as an attachment in one Catalog Item so that whenever form loads the attachment will be visible and any user can download it.

And once the user downloads the attachment will fill it up and again attach the same.

While clicking on Submit I want an alert to be popup if user forgets to attach the file in the Catalog Item.

Can anyone let me know how to achieve this?

 

 

Thanks,

SNOW@Das

17 REPLIES 17

Hi,

Please kindly suggest me as I am getting bit confused.

I need to attach the file within one variable as a link to download it.

But when I tried that as HTML Type it is not working perfect as the Description field is also coming on the form.

find_real_file.png

 

Catalog Item View:

find_real_file.png

And I forgot to mention that the Script does work for me and my concern is will it also work for Service Portal as well?

 

So please kindly suggest me how can I achieve the same?

 

Thanks in Advance,

SNOW@Das

That's why I suggest putting link under item description not into variable.

find_real_file.png

 

For service portal you might need to add another script:

function onSubmit() {
	
		var isAttachmentMandatory = true;
	
		if(isAttachmentMandatory) 
		{
		var isOnServicePortal = parent.document.URL.indexOf('deus?id=sc_cat_item') != -1;
		console.log('isOnServicePortal : ' + isOnServicePortal);
		if(isOnServicePortal && parent.document.getElementsByClassName('file-list-wrap').length == 0)
		{
			getMessage('Alert Message', function(msg) {
				g_form.addErrorMessage(msg);
			});
			return false; 
		}
			return true;
	}
}

 

Hi Slawek,

Actually the problem is there is already one link I have added in the Description and it is appearing at the top of the Catalog Item.

So instead of which I want to add it might be below of all the Variables.

Please suggest me on the same.

And for Service Portal do I need to add the script which you have mentioned in previous post?

So there will be two OnSubmit Client Scripts.

 

Thanks,

SNOW@Das

You can add both if you want. One will work in native platform second on Portal. 

I am no sure how to add link below item.

Maybe you can add this link as additional info but to existing variable instead of adding new one like you tried. 

Hi,

I tried the script for Service Portal but it seems it is not working incase of Service Portal.

find_real_file.png

Can  you please check and let me know?

 

Thanks,

SNOW@Das