The CreatorCon Call for Content is officially open! Get started here.

How to restrict end user to delete attachment based on HR Case state?

Sri56
Tera Contributor

Hi Team,

 

We have a requirement where we need to restrict an end users to delete an attachment on portal when the state of HR case is either draft or custom action. (attachement deletion is allowed on these states only)

I tried with ACL.

Still not working!

 

Please help!

 

Thanks,

Sri

6 REPLIES 6

Is this the only delete ACL you have on the attachment table now? 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Sumanth16
Kilo Patron

Hi @Sri56 ,

 

Name: Restrict Delete attachment on RITM
Table: sys_attachment
Advanced: check
When: Before
Delete: check


Filter Condition: Table Name is sn_hr_core_case(HR Table name) and state is new(change to your state)

Script Conditon:

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

// Add your code here

if(!gs.hasRole('admin')){

current.setAbortAction(true);

}
})(current, previous);

 

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda