Regarding onsumbit client script

Apoorva A H
Tera Contributor

 Code for  and what UI type should i need  to create an on-behalf leave I must add an attachment (any type of file is valid, encrypted or not encrypted). and  I try to create an on-behalf leave without an attachment I can't submit the request and the following message appears:

    1. "Uploading supporting document is mandatory"
11 REPLIES 11

Hello @Apoorva A H 

 

create a on display business rule that will setup a scratchpad variable

 

(function executeRule(current, previous /*null when async*/) {
      
g_scratchpad.hasAttachments = current.hasAttachments();

})(current, previous);

 

Now, You have to call the scratchpad variable into the client script :-

 

function onSubmit(){

if (!g_scratchpad.hasAttachments)
{
alert('Upload Supporting document is mandatory');
}

}

 

Plz mark my solution as Accept, If you find it helpful.

 

Regards,

Samaksh

Hello @Apoorva A H 

 

Plz mark my solution as Accept, If you find it helpful.

 

Regards,

Samaksh