Make the Attachment Type Field on the form Read only on condition

Madhan007
Tera Contributor

I have Supporting Docs (Attachment Type)  field on Table IT Tracker. I want to make the Attachment type field read only when the state of the request  is closed. I tried UI policies and client scripts, but it did not work. I understand that ACL's are the only way to do it, can you guide me through the steps ?

Thank you!! 

1 ACCEPTED SOLUTION

swathisarang98
Giga Sage
Giga Sage

Hi @Madhan007 ,

 

Yes you have to create acl for that field,

 

If you want to allow user to download but stop from uploading or deleting attachment then create operation write acl,

 

 

If you want to restrict user the visibility of that field then you can write read acl 

check advanced in acl and write your script,

 

Here i have written write on file attachment field so when state is closed complete it doesn't allow me to write anything (such as update or delete)

swathisarang98_0-1711480610077.png

 

modify the below  script according to your need,

 

 

 

	if (current.state == '3') //chceking the state is closed complete
 {
		//gs.info("acl " + current.state);
        answer = false; //return false acl 
    } else {
	//	gs.info('else');
        answer = true;
    }

 

 

 

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

View solution in original post

6 REPLIES 6

AshishKM
Kilo Patron
Kilo Patron

Hi @Madhan007 ,

Can you share the screen shot of that page and UI Policy/Client Script, you have written so far.

 

-Thanks,

AshishKM


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

swathisarang98
Giga Sage
Giga Sage

Hi @Madhan007 ,

 

Yes you have to create acl for that field,

 

If you want to allow user to download but stop from uploading or deleting attachment then create operation write acl,

 

 

If you want to restrict user the visibility of that field then you can write read acl 

check advanced in acl and write your script,

 

Here i have written write on file attachment field so when state is closed complete it doesn't allow me to write anything (such as update or delete)

swathisarang98_0-1711480610077.png

 

modify the below  script according to your need,

 

 

 

	if (current.state == '3') //chceking the state is closed complete
 {
		//gs.info("acl " + current.state);
        answer = false; //return false acl 
    } else {
	//	gs.info('else');
        answer = true;
    }

 

 

 

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

Hi @swathisarang98 , I want to allow users to read but not write/update the attachments. so I am creating a write ACL on the field. but can I give the condition as state is closed in Conditions field instead in script?

Thank you!!

@Madhan007 I tried that but for some reason if i give direct condition it didn't work for me so i went ahead with scripting. Let me know if you are facing any issues

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang