it sounds like you need a detailed investigation. Unfortunately I can't give you the time/effort that you need to resolve this for free.
Original Message:
Sent: 11-07-2024 12:00
From: Ishwarya Soundarya
Subject: Show error when the project Budget is exceed
Hi Mark,
yes I have used the code , raise TypeError(mbo.getDouble("ABVBUDGETREMAINING_NP")) to check what the ABVBUDGETREMAINING_NP holds and is it showing the value as per record. But the value shows as 0.0
And I have used service.error method still the value is 0.0.Though the ABVBUDGETREMAINING_NP holds 4190.23 in the record.
Thanks in Advance
------------------------------
Ishwarya Soundarya
Accenture
Original Message:
Sent: 11-06-2024 14:14
From: mark robbins
Subject: Show error when the project Budget is exceed
" remainingBudget=workorder.getDouble("BUDGETREMAINING_NP")
woNumber=workorder.getString("WONUM")
if remainingBudget<0:
setError("BUDGETEXCEED","BUDGET",[workorder.getString("PROENGR"),woNumber])
Here the attribute "BUDGETREMAINING_NP" is non-persistent field with type as Decimal, but every time when the code hits, the result is providing as 0.0 but the attribute has positive values also negative values. Still it shows as 0.0. There is no existing script that affects."
Have you added some code to log the value that is returned in the code above? - before the if statement
Consider switching the SQL logger to INFO and watch when the budget figure is being updated.
i suspect that the autoscript is firing before the figure is being updated. If that is the case then it would explain why your check fails.
Jade highlighted the need to use the service.error method rather than the current error routine. I would definitely switch to the service call as that guarantees that the save would be stopped because of the error
------------------------------
mark robbins
Cohesive
IBM Champion 2017-2023 Inclusive
See my blog on Maximo support related topics here:
https://www.linkedin.com/pulse/maximo-support-advice-from-non-ibm-engineer-article-mark-robbins/
Original Message:
Sent: 11-06-2024 06:00
From: Ishwarya Soundarya
Subject: Show error when the project Budget is exceed
Hi All,
Thanks for your support. Below is the script I have created with Object launch point (LABTRANS) on Add, Update event with Before Save.
from psdi.mbo import MboConstants
from psdi.util import MXApplicationException
def setError(messageKey, messageGroup,arguments):
global errorkey,errorgroup, params
errorkey = messageKey
errorgroup = messageGroup
params = arguments
workorderSet=mbo.getMboSet("realtionshipname")
if not workorderSet.isEmpty():
workorder=workorderSet.getMbo(0)
remainingBudget=workorder.getDouble("BUDGETREMAINING_NP")
woNumber=workorder.getString("WONUM")
if remainingBudget<0:
setError("BUDGETEXCEED","BUDGET",[workorder.getString("PROENGR"),woNumber])
Here the attribute "BUDGETREMAINING_NP" is non-persistent field with type as Decimal, but every time when the code hits, the result is providing as 0.0 but the attribute has positive values also negative values. Still it shows as 0.0. There is no existing script that affects.
To check, I have used this code - > raise TypeError(workorder.getDouble("BUDGETREMAINING_NP"))
I have also tried reset() method for the set and, getInt(), getFloat() to get the attributes. Nothing works. But the script works in work order application but not in Labor reporting application.
Could you help me why the attribute always shows as 0.0 value.
Thanks in Advance
------------------------------
Ishwarya Soundarya
Accenture
Original Message:
Sent: 11-04-2024 08:52
From: mark robbins
Subject: Show error when the project Budget is exceed
As Jade says you should use the service.error code if you are using one of the latest 7.6 or MAS versions.
using the errorkey/errorgroup doesn't immediately stop the script's execution so you can get unwanted actions.
Abdul is giving good advice. you don't say which object events are being used to trigger the script.
Is the script being triggered before or after the save?
your use case means that the script needs to be triggered BEFORE the save occurs.
Have you added code to log the details of the remaining budget (balBudgetAmount) ?
is the remaining budget being calculated AFTER your script is being fired?
------------------------------
mark robbins
Cohesive
IBM Champion 2017-2023 Inclusive
See my blog on Maximo support related topics here:
https://www.linkedin.com/pulse/maximo-support-advice-from-non-ibm-engineer-article-mark-robbins/
Original Message:
Sent: 11-04-2024 08:30
From: Jade Warren
Subject: Show error when the project Budget is exceed
I don't know about the specifics of how the budget logic plays across applications, but something did stand out to me. I've in the past experienced less-than-desirable timeliness w/throwing errors using the methodology in your script.
global errorkey,errorgroup, params
errorkey = messageKey
errorgroup = messageGroup
params = arguments
Rather than that code, I prefer to use the scripting service object--you can accomplish the same thing this way, with two benefits. First, it is cleaner (single line). Second, it seems to throw the errors RIGHT AWAY rather than with inexplicable delays...
service.error(messageGroup, messageKey, [params]);
Good luck!
------------------------------
Jade Warren
Great River Energy
Original Message:
Sent: 11-02-2024 09:08
From: Ishwarya Soundarya
Subject: Show error when the project Budget is exceed
Hi All,
I have created a script to throw error when the budget is exceeded from the work order application with the below script using object lp WORKORDER.
from psdi.mbo import MboConstants
def setError(messageKey, messageGroup,arguments):
global errorkey,errorgroup, params
errorkey = messageKey
errorgroup = messageGroup
params = arguments
if (mbo.isModified("ABVBUDGETREMAINING_NP") or mbo.isModified("ACTTOTALCOST") or mbo.isModified("ACTLABCOST")):
budgetAmount=mbo.getDouble("ABBCURRCOMMIT")
balBudgetAmount=mbo.getDouble("ABVBUDGETREMAINING_NP")
if (balBudgetAmount<0):
setError("ABVBUDGETEXCEED","ABVBUDGET",[mbo.getString("ABBENGR"),budgetAmount])
Now my requirement is to show the same error that the project budget is exceeded when i am reporting from the Labor reporting application by choosing Enter by work order.
I am choosing Labor reporting module, then from the common actions i am picking Enter by work order and giving the work order details and creating a new row to chose the Labor. After filling the costs /rate, i am clicking ok and the record is getting saved which is not correct.
Note: The budget remaining is in negative number, also the actual total cost is greater than the budget amount in the work order module.
So could anyone please help to write an automation script to show the same error that the project budget is exceeded when i am reporting from the Labor reporting application by choosing Enter by work order.
Thanks in Advance
Regards,
Iswarya
#EverythingMaximo
#Reporting
#WorkManagement
------------------------------
Ishwarya Soundarya
Accenture
------------------------------