List and Detail Form

Hi

I have created a List and a detail form using outsystems. 

I have the following fields/attributes 

Question

Sort Order

Status - Active/Inactive

Created by

Created Date Time


When I create a new question all fields are editable but when I edit/update create and created date time are view/enabled false.

Help please.

Hi,


That conditions are verified/changed in the widget (the one that holds the attribute that you want) properties:

Check this conditions and configure it the way you need. 


Hope this can help.

Regards,

Ricardo

Hi Ricardo


I tried enabled false but that disables the field for New and Edit/Update.


It looks like there should be a if condition to see if it is edit or new to dynamically enable the controls.


Regards


What is the behavior that you need? If you want to have that disable only when it's not new (when new you can edit) you just need to write in the "Enabled" *****Id = NullIdentifier(). (the ***** is the input parameter with the id).

An example:


Hope that this can help.


Regards,

Ricardo

Thank you it worked

Ok!


By the way, this kind of data can be stored automatically. There's an example:


In this case, you don't need to have the widgets "Enable" and you can change the "Visible" property just to show that information when it's not new. 


Regards,

Ricardo

Ricardo Pereira wrote:

Ok!


By the way, this kind of data can be stored automatically. There's an example:


In this case, you don't need to have the widgets "Enable" and you can change the "Visible" property just to show that information when it's not new. 


Regards,

Ricardo

Hi Ricardo


I tried this method logically this looks ideal but was not able to get my solution to work.


This is my condition for Is New ? 

SyntaxEditor Code Snippet

AuditQuestionForm.Record.AuditQuestion.Id=NullIdentifier()


For New I gave two Assignments 

SyntaxEditor Code Snippet

AuditQuestionForm.Record.AuditQuestion.CreatedBy = GetUserId()

SyntaxEditor Code Snippet

AuditQuestionForm.Record.AuditQuestion.CreatedDateTime=CurrDateTime()


Can you share a print from your "Save" logic please? It's easy to understand!


Thanks!

So far as I see it's ok.

What it the behavior that you're getting now?

Hi Ricardo

I was wondering why this should called in the save action and not during preparation or any other load action as these two fields should be populated with value(Created by and Created Date Time)


This is the Details form that loads from the Main form?


Hi,

When you load the form when it's new, it doesn't exist (NullIdentifier()). So, you can cancel the operation and don't save. You just need to save that data (created by and Creation Date) if you save that form and he pass to exist. 

It don't make much sense to create more logic in Details preparation for that. But, depend of the use case. You need to evaluate what fills better your needs. 


Regards,

Ricardo

Hi Ricardo


Do you have a documentation/oml you can share please.

Solution

Hi,


There is a quick example. Take a look at the preparation and the save logic. In the form, take a look at the "Visible" properties from the Create By and Datetime of creation Containers.

This is the common case. 

Hope this can help you.


Regards,

Ricardo

Solution

Thank you Richardo, It worked after I changed the Display property on the container.