Question
Zensar Technologies Ltd
IN
Last activity: 23 Jan 2024 2:59 EST
Obj-Open Vs Obj-Open-By Handle
Hi, Case 1:- If we have Obj-Open then why we need Obj-Open-By-Handle in Pega?
Case 2 :- Why we only provide pyID in case of Obj-Open method ? Can we pass pzInsKey in Obj-Open method?
Case 3:- In what scenario we should use Obj-Open-By-Handle?
-
Reply
-
Ambili Thomas S MANOJ KUMAR REDDY -
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
NCS Pte. Ltd
SG
Hi @AbhishekC1725: Were you able to check the previous post here,
Obj-Open-By-Handle uses the handle of the record (pzinskey) where as Obj-open uses the primary keys of the class (class keys can be different than pyID based on implementation).
See this and this for details of each method
Thanks.
Zensar Technologies Ltd
IN
@ArulDevan Thanks for response 😊.
Updated: 22 Jan 2024 23:37 EST
Rulesstack Private Limited
IN
Hi @AbhishekC1725,
Case 1: Obj-Open vs. Obj-Open-By-Handle
Obj-Open is a general-purpose method for opening an object instance based on its class key/Primary key. It's the safer and more common choice in most cases.
Obj-Open-By-Handle uses an internal, system-generated pzInsKey to open an instance. This pzInsKey is unique and permanent, unlike the class key which can be shared by multiple instances. Use Obj-Open-By-Handle only when:
- If we know the exact pzInsKey of the specific instance you want to open.
- Performance is critical: Obj-Open-By-Handle can be slightly faster than Obj-Open in some situations.
In summary:
- Use Obj-Open for most cases.
- Use Obj-Open-By-Handle only when needed for specific reasons.
Case 2: pyID and pzInsKey in Obj-Open
pyID in Obj-Open: In Pega, pyID is the property that holds the unique identifier for an instance. When using Obj-Open, you typically provide the key values for the class in order to uniquely identify the instance. pyID is often used as part of these key values.
Hi @AbhishekC1725,
Case 1: Obj-Open vs. Obj-Open-By-Handle
Obj-Open is a general-purpose method for opening an object instance based on its class key/Primary key. It's the safer and more common choice in most cases.
Obj-Open-By-Handle uses an internal, system-generated pzInsKey to open an instance. This pzInsKey is unique and permanent, unlike the class key which can be shared by multiple instances. Use Obj-Open-By-Handle only when:
- If we know the exact pzInsKey of the specific instance you want to open.
- Performance is critical: Obj-Open-By-Handle can be slightly faster than Obj-Open in some situations.
In summary:
- Use Obj-Open for most cases.
- Use Obj-Open-By-Handle only when needed for specific reasons.
Case 2: pyID and pzInsKey in Obj-Open
pyID in Obj-Open: In Pega, pyID is the property that holds the unique identifier for an instance. When using Obj-Open, you typically provide the key values for the class in order to uniquely identify the instance. pyID is often used as part of these key values.
pzInsKey in Obj-Open: While you can use pzInsKey to uniquely identify an instance, it's not a recommended practice in Pega. pzInsKey is an internal system property, and it's not intended for external use. It's safer and more standard to use the class's primary key properties (including pyID) when working with Obj-Open
Case 3: Using Obj-Open-By-Handle
Use Obj-Open-By-Handle when:
- If we know the exact pzInsKey of the instance go for Obj-Open-By-Handle.
- You need maximum performance and Obj-Open is too slow..
Remember:
- Always prioritize Obj-Open unless there's a specific reason to use Obj-Open-By-Handle.
- Make sure you understand the handle format and how to obtain it accurately.
- Specify the Step Page (where to load the opened instance) to avoid overwriting existing data.
I hope this clarifies the differences between Obj-Open and Obj-Open-By-Handle, and when to use each one.
Regards,
Mohd Qizer Uddin
Zensar Technologies Ltd
IN
@Mohd Qizer Uddin Thank you for such a nice detailed explanantion 😊. In Obj-Open we can pass multiple key if our class definition have more than one key right?
Accenture
IN
1. Obj-Open is like a select query where conditions can be multiple and still get a lot of cases. Obj-Open-By-Handle is opening a selective case where you know the key.
2. It's not recommended by pega to use pzInskey in Obj-Open.
3. When you need a high performance and have to open only one case , go for Obj-Open-By-Handle.
Hope this helps.
Zensar Technologies Ltd
IN
@GiridharanVenkat Thanks for response 😊.
Aaseya IT Services Pvt Ltd
SA
I think below points has all your answers.
- Use
Obj-Open
when you need to retrieve instances based on specific search criteria and when you expect multiple instances to match the criteria. - Use
Obj-Open-By-Handle
when you already have the handle of a specific instance and want to directly open that instance without the need for additional search criteria. Obj-Open
provides flexibility in filtering and retrieving instances based on various search criteria, whereasObj-Open-By-Handle
is more suitable for directly opening a specific instance.- Both methods can be used to open instances of any class in Pega, including work items, data objects, and other custom classes.
Updated: 30 Jan 2024 12:52 EST
Zensar Technologies Ltd
IN
Thanks for response 😊.
Just one thing want to clear
In your response "Obj-Open provides flexibility in filtering and retrieving instances based on various search criteria,"
So our Obj-Open method can have more then one PropertyName and PropertyValue that is you want to say right?