Restricting users from deleting the attachments added to the Incident or Quote (395 Views)
Reply
Valued Contributor
GayathriTCS
Posts: 271
Registered: ‎07-22-2010
Message 1 of 7 (395 Views)

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.

Honored Contributor
John Stagaman
Posts: 3,428
Registered: ‎07-13-2007
Message 2 of 7 (366 Views)

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...
Valued Contributor
GayathriTCS
Posts: 271
Registered: ‎07-22-2010
Message 3 of 7 (360 Views)

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.

Honored Contributor
Jacob Heubner
Posts: 4,177
Registered: ‎07-21-2008
Message 4 of 7 (353 Views)

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()

    }

}

Valued Contributor
GayathriTCS
Posts: 271
Registered: ‎07-22-2010
Message 5 of 7 (340 Views)

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.

Honored Contributor
Jacob Heubner
Posts: 4,177
Registered: ‎07-21-2008
Message 6 of 7 (334 Views)

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.
Trusted Contributor
ALARMus
Posts: 985
Registered: ‎10-06-2009
Message 7 of 7 (321 Views)

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

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.