Default select record in static entity when filling out a forum

Default select record in static entity when filling out a forum

  

Hi,

Currently working on a web application to allow employees within a company to request holiday days. I have created a request entity that holds the data of the request (such as dates, reason and so on). This entity is linked to a static entity that is used to track the progress of the request review(Pending, Approved, Declined).

My issue is that on the forum that the user completes to make a request, I want to have the request review default marked as Pending (as it has to go to review with management). I am using a assign statement in the button that submits the forum to set the request review ID to 1 which is the ID for Pending, however the data is saved with an ID of 0.

Can any provide some insights on how to correctly do this?

Thanks 

Peter

Found a Solution...

Moved the assignment from the submit button at the end of the forum to the Preparation action at the opening of the forum/screen and this has resolved my issue. 

https://www.outsystems.com/forums/discussion/36608/special-list-value-as-default-value-of-combo-box/

This is the link to another users' question that was very similar to mine and the answer was given on that thread. 

Hi Peter,

In the Preperation, everything is set up to display the Screen. This means that yes, you need to assign any default values that you also want to see on the Screen in the Preperation.

Another note: never assign Id values directly. In case of a Static Entity, use Entities.EntityName.RecordName instead.

Kilian Hekhuis wrote:

Hi Peter,

In the Preperation, everything is set up to display the Screen. This means that yes, you need to assign any default values that you also want to see on the Screen in the Preperation.

Another note: never assign Id values directly. In case of a Static Entity, use Entities.EntityName.RecordName instead.

Thanks Killian,

Will update the Preparation so it doesn't assign the record using the ID.

What is the reason for not using the ID to assign a static entity though?? Is it just good practice to use Entities.EntityName.RecordName? 


Hi Peter,

The whole idea of Static Entities is that they function as constants, and that you have an easy way to reference them. You should provide the "Identifier" column with a good descriptive name of course. Reading the code is much, much easier then! Also, Ids are never guarenteed to stay the same across environments, so what is #1 on dev could easily be #2 on production, for example.

Kilian Hekhuis wrote:

Hi Peter,

The whole idea of Static Entities is that they function as constants, and that you have an easy way to reference them. You should provide the "Identifier" column with a good descriptive name of course. Reading the code is much, much easier then! Also, Ids are never guarenteed to stay the same across environments, so what is #1 on dev could easily be #2 on production, for example.

Sweets Thanks, Will keep that in mind from now on.