Service Manager / Service Center Practitioners Forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Restricting users from deleting the attachments added to the Incident or Quote

GayathriTCS
Member

Restricting users from deleting the attachments added to the Incident or Quote

Hi Experts ,

 

we have a requirement of restricting the users or any members from assignment group from removing or deleting the added attachment from the incident or Quote , is there any posssiblity to do that in HPSM 9.30.

6 REPLIES
John Stagaman
Honored Contributor

Re: Restricting users from deleting the attachments added to the Incident or Quote

You can make an attachment object read-only, but then the user would be unable to add an attachment either.

----------------------------------------------------
Kudos - what, where, how, and why
Want Good Answers? Ask Good Questions...
GayathriTCS
Member

Re: Restricting users from deleting the attachments added to the Incident or Quote

No we dont want the option to be read only , but instead it should not let the users to delet the attachments , can we set any JS to do so.

Jacob Heubner
Honored Contributor

Re: Restricting users from deleting the attachments added to the Incident or Quote

I haven't fully tried this out, but a quick test shows it's possible.

 

Type "triggers" in the command window.  This will open up the triggers table.

Add a record like the following.

 

Trigger Name: prevent.attachment.deletion

Table Name: SYSATTACHMENTS

Trigger Type: 6 - After Delete

 

Script:

if (record.application == "probsummary" || record.application=="ocmq"){

    print("You are not allowed to delete attachments.  The attachment was not deleted")

    record.doInsert()

}

 

What this does -

The user actually _does_ delete the attachment, but, as soon as they finish, the system re-creates it.  You can add other conditions inside there - like maybe only particular assignment groups can delete, or SysAdmins can delete - by modifying the script like this:

 

var capex = vars.$lo_ucapex.toArray()

if (record.application=="probsummary" || record.application="ocmq"){

    if (capex.indexOf("SysAdmin")<0){

        print("You are not allowed to delete attachments.  This attachment was not deleted.")

        record.doInsert()

    }

}

GayathriTCS
Member

Re: Restricting users from deleting the attachments added to the Incident or Quote

Hi ,

 

Your solution actually worked out, but in case if i have to add 2 more groups which should have rights to delete the attachment , how do we modify the script .

 

we needs Even test1 group to be given access. Have already created a capablity word for that group.

Jacob Heubner
Honored Contributor

Re: Restricting users from deleting the attachments added to the Incident or Quote

Follow the example. I showed you how to do it with the SysAdmin capability word... If you've got a different capability word, replace SysAdmin with your capability word. The answer wasn't meant to be a replacement for your coding, but to give you an understanding of a direction to go to get the result you're looking for.
Highlighted
ALARMus
Occasional Visitor

Re: Restricting users from deleting the attachments added to the Incident or Quote

I don't see what to forbid to make record in the table.

May be sloution more easy if you will use Format Control - Initial expression (with capability word) and Verification

//Add this to "OnDomLoad" event