Variable output setup of specific field of last record

Please refer to the TestJobPopUp, I have encountered some difficulty in getting the variable value in Save logic.

When I create or update the record, I would like to get the status of lastphase Task. I have created a variable "LasthphaseStatus", May I know How can I get it as my variable output. I would like to use it as some conditional check later.

E.g. When I save TaskID91, the last phase is 100 returned from directors, then I want the outputted value of  LasthphaseStatus for cuurent record is "Completed" (As TaskID 86 is 100 returned from directors, and status id Completed  ). Kindly advise.



Hi Winnie

This looks to me as something from the previous row. I think you have to select the last phase (previous values) somehow in your advanced query. Then you can select it, because it is in the current record.

But it will be difficult to get the previous values. You need to do this with an advanced query, and use the PARTITION or the LAG value, or do a LEFT JOIN with the previous row.

 You can find several examples when you google, but this is one of them:


Hi Winnie Lam, to improve control and add rules when saving job details in an OutSystems application, create a custom action. In this action:

1. Retrieve the latest job detail from the database using the Get_Last_Job_Detail aggregate, limiting to 1 row and sorting by ID in descending order.

2. Assign the value of the last phase from the current record based on the PhaseId obtained.

3. Apply necessary rules to the data.

4. Call this action where needed to ensure rules are applied when saving job details.

This will help maintain control and ensure data complies with rules in your OutSystems application, while also updating the current record's phase based on the last recorded phase.

Can you share the oml for my study? What I expect is to the status of 'last phase', but last phase may not be the previous Task ID.

When everytime save the table, each record will check if the status of last phase is "Completed" or not, if it is completed, then save succesfully. 

The logic is like that, so I needa get the status of "Last phase"  first 

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.