How to retrieve the list of object instead of current working object

0
Hi All, I need solution hope you guys help me. I have a data grid which contains 4 record. example: id  name  1   PQR 2   XYZ 3   ABC 4   MNO so I am using same page for new and edit buttons. So here ID should be unique. But it also allowed to edit the values. My question is if I select the Id 2 record and hit the edit button to edit the detail , if I add Id 3(already present) its should hit the validation message Id is already present. Its working fine till now. But if I am editing the ID2 details still its showing validation message and that I don’t want because I want to edit some values here. Can you please tell me how can I achieve this or is there any way to retrive the list instead of current object that I am editing now. Please help me. Thanks  
asked
2 answers
1

Hi Priyanka,

 

If I understand correctly, you need help creating your validation microflows which checks whether an object with a certain ID already exists.

 

If you want to do this, you can use a Retrieve Action to retrieve all objects of this entity from the database.

 

Because you want to check whether there is an objects which has the same ID as the object you are currently editing, you can constrain your Retrieve Action as follows: 

[ExampleAttribute = $ExampleEntity/ExampleAttribute]

 

The only problem now is that if we Edit an object which is already in the database, and try to save this, the validation message will be shown. To handle that we allow saving an existing object, add the following Xpath constraint to your retrieve action. This will exclude the object you're currently editing from your retrieve. 

[id != $ExampleEntity]

 

Now your validation flow could look as follows:

answered
0

With you explanation i can guess that your ID field is not of type autonumber (because you want to give the option of editing)

Now you can have a BeforeCommit Microflow setup on your entity (in the domain model you can double click the entity and find the tab Event Handlers in the end)

On this BeforeCommit Microflow, the incoming data is the one you entered on the New/Edit page. You can first do a DB retrieve on the data and see if it exists, if not you can create it.

 

Would this be something of interest to your flow? let me know.

answered