-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmxc_create_bboard.py
54 lines (37 loc) · 1.63 KB
/
mxc_create_bboard.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Maximo 7.6.x automation script to create bulletin board message
from psdi.app.bulletinboard import BBSet
from psdi.server import MXServer
from java.util import Calendar
from psdi.mbo import MboConstants
service.log(scriptName + " [BEGIN]")
mxServer = MXServer.getMXServer()
userInfo = mbo.getUserInfo()
curDate = mxServer.getDate()
calendar = Calendar.getInstance()
calendar.add(Calendar.DATE, 7)
expDate = calendar.getTime()
bulletinSet = mxServer.getMboSet("BULLETINBOARD",mxServer.getUserInfo("MAXADMIN"))
bulletin = bulletinSet.add()
bulletin.setValue("SUBJECT","A high priority PO was assigned to you for review")
bulletin.setValue("MESSAGE","see PO AB12345 ")
bulletin.setValue("POSTDATE",curDate)
bulletin.setValue("EXPIREDATE",expDate)
bulletin.setValue("STATUS","APPROVED", MboConstants.NOVALIDATION_AND_NOACTION | MboConstants.NOACCESSCHECK)
bulletinId = bulletin.getString("BULLETINBOARDID")
service.log(scriptName + " [BULLETINID] " + str(bulletinId))
bulletinSet.save()
bulletinAudienceSet = bulletin.getMboSet("BBAUD")
bulletinAudience = bulletinAudienceSet.add()
bulletinAudience.setValue("BULLETINBOARDID",bulletinId)
bulletinAudience.setValue("PERSONGROUP","MAXADMIN")
bulletinAudienceSet.save()
bulletinStatusSet = bulletin.getMboSet("BBSTATUSHISTORY")
bulletinStatus = bulletinStatusSet.add()
bulletinStatus.setValue("BULLETINBOARDID",bulletinId)
bulletinStatus.setValue("CHANGEDATE",curDate)
bulletinStatus.setValue("CHANGEDBY","MAXADMIN")
bulletinStatus.setValue("STATUS","APPROVED")
bulletinStatusSet.save()
status = bulletin.getString("STATUS")
print(scriptName + " [STATUS]: " + str(status))
service.log(scriptName + ": [END]")