SCTask Attachment Mandtory

nameisnani
Mega Sage

Hi Team , 

 

My Requirement is to make attachment mandatory for SCTASK based Following conditions. Please let me know how to achieve this using the OOB configuration .  

 

  1. It should a ( LAPTOP ) catalog item .
  2. Short description contains keywords ( Access Request ) 
  3. When the SCTASK state moves to closed complete .

 

Thanks in Adavance 

 

@Saurav11 

4 REPLIES 4

Mayur2109
Kilo Sage
Kilo Sage

Hi @nameisnani 

 

Please refer below community post.

Making an attachment mandatory in a catalog task 

 

Please check and Mark Helpful and Correct if it really helps you.

Regards,
Mayur Shardul

SwathiSarang
Tera Contributor

Hi @nameisnani,

 

You can write Before update Business rule with all the condition you want and then in advanced you can add the below script,

 

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here


    if (current.hasAttachments() != true) {
        gs.addErrorMessage('Attachment is mandatory');
		current.setAbortAction(true);
    } else {
        gs.addInfoMessage('There is attachment');
        
    }


})(current, previous);

 

 

If my answer solved your issue, please mark my answer as  Correct & 👍Helpful based on the Impact.

 

Thank You

Swathi Sarang


Hope this solves your question. if it does, please mark my response helpful and solution accepted.

Thank you
Swathi Sarang

SwathiSarang
Tera Contributor

Hi @nameisnani,

 

You can write Before update Business rule with all the condition you want and then in advanced you can add the below script,

 

 

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here


    if (current.hasAttachments() != true) {
        gs.addErrorMessage('Attachment is mandatory');
		current.setAbortAction(true);
    } else {
        gs.addInfoMessage('There is attachment');
        
    }


})(current, previous);

 

 

 

If my answer solved your issue, please mark my answer as  Correct & 👍Helpful based on the Impact.

 

Thank You

Swathi Sarang


Hope this solves your question. if it does, please mark my response helpful and solution accepted.

Thank you
Swathi Sarang

swathisarang98
Giga Sage
Giga Sage

Hi @nameisnani,

 

You can write Before update Business rule on sc_task table with all the condition you want and then in advanced you can add the below script,

 

Screenshot 2023-10-13 at 6.38.42 PM.png

 

 

 

(function executeRule(current, previous /*null when async*/ ) {

    // Add your code here


    if (current.hasAttachments() != true) {
        gs.addErrorMessage('Attachment is mandatory');
		current.setAbortAction(true);
    } 


})(current, previous);

 

 

 

If my answer solved your issue, please mark my answer as  Correct & 👍Helpful based on the Impact.

 

Thank You

Swathi Sarang