Hi Steven, I tried your code and it worked great !!
Thank you so much for helping out.
from psdi.common.context import UIContext
from psdi.webclient.system.controller import SessionContext, Utility, WebClientEvent
from psdi.webclient.system.session import WebClientSessionManager
from psdi.mbo import MboConstants
mbo.setValue("ATTR1", "12")
session=service.webclientsession()
appBean=session.getCurrentApp().getAppBean()
appBean.save()
------------------------------
aditi jain
------------------------------
Original Message:
Sent: Fri July 29, 2022 01:34 PM
From: Steven Shull
Subject: Record change Bug while calling save in Attribute Level Automation Scripts
You have to interact with the bean class so you might as well just call the bean class save event. For an action button, you have access to the UI framework pretty easily. Something like below
session=service.webclientsession()
appBean=session.getCurrentApp().getAppBean()
appBean.save()
------------------------------
Steven Shull
------------------------------
Original Message:
Sent: Fri July 29, 2022 01:22 PM
From: aditi jain
Subject: Record change Bug while calling save in Attribute Level Automation Scripts
Thank you very much Steven and Tim for your inputs.
I understand that calling Save in Attribute level script is never recommended, but same redirect is happening on Action level script too (while button click on new records).
So if I really have a case where I need to save a new record from button, then should incorporating missing logic that " handles getting back to the newly created record"
work?
------------------------------
aditi jain
Original Message:
Sent: Fri July 29, 2022 09:17 AM
From: Steven Shull
Subject: Record change Bug while calling save in Attribute Level Automation Scripts
I have to strongly second what Tim stated. Never save for the user based on a field being entered. It's not just the change to your field that gets saved and you prevent them from having a chance to discard it. They may not have everything defined that they need.
The reason this redirects you to a random record where the user explicitly saving does not is because there is logic in the AppBean save method that handles getting back to the newly created record. Since you're calling save on the set (not utilizing the app bean), you don't have this special logic to handle getting back to this record.
------------------------------
Steven Shull