i am getting an error getElementsByClassName(). how can i resolve it?

asha4
Kilo Contributor

i am getting an error getElementsByClassName(). how can i resolve it?

for getting the attachments length i have used this method 

1 ACCEPTED SOLUTION
10 REPLIES 10

Not applicable

Hi Asha,

 

shall we know whats the error and your logic.

 

/Hemanth

function onSubmit() {
//Type appropriate comment here, and begin script below


if (this.document.getElementsByClassName('get-attachment').length != 2) {
alert('You must attach the 2 attachments');
return false;


}

}

asha4
Kilo Contributor

i am using this code in  record producer  for submitting the attachment both in portal and instance with length must be 2.

Ruhi Jibhyenka1
Mega Guru

Hi Asha,

You can do it in a before business rule and check for file length.

Below is the script-

var str = current.file_name;

str = str.split('.');

var strtlen = str[0].length;

if(strlen >100) {

current.file_name = str[0].slice(0,99);

}

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy.

Thanks,

Ruhi.