The web blog http://www.learnsccd.com strives to be a comprehensive guide to SCCD, TADDM, SERVICE NOW and MAXIMO tools. This is a personal site maintained solely by me. I intend to update it regularly.For live updates please follow us on.

How to get Service Request Contains Attachments and Display Number of Attachments using Automation Script

How to get Service Request Contains Attachments

1. Create one new field to display Attachment Count in Service Request Application.
    Attachment Count(Attribute Name-XYZ)
2. Create Automation Script to get count and Display in Attachment Count Field.
3. Go To->System Configuration->Platform Configuration->Automation Scripts
4. Create Object Launch Point with below details
    Script Name: Test
    Script Description: Test
    Script Language: Jython
    Object : SR
    Events-select Save radio button,on Save Event select 3 checkboxes(add,update,delete) and   select Before Save Radio button.
5.Click Next and provide launch point details as mentioned below
   Launchpoint Name: Test
   Description: Test
6. Click Next and Copy the code ,Click On create.
   
from psdi.mbo import MboSet
from psdi.mbo import MboConstants
from psdi.mbo import Mbo

ticid=mbo.getString("TICKETUID")
orgcls=mbo.getString("CLASS")
docquery="ownerid='"+ticid+"'"+ "AND OWNERTABLE='"+orgcls+"'"
docMboSet=mbo.getMboSet("$$DOCLINKS","DOCLINKS",docquery)
count=docMboSet.count()
count1=str(count)
mbo.setValue("XYZ",count1)