46
Views
22
Comments
Solved
How to fetch the Lost fields  using on after fetch
Question

HI Everyone,

I am New to the Outsystems, I don't know  how to fetch multiple documents from the data base in On After Fetch.

I created List screen, When I Click name it will redirect edit state and image, Email, Phone Number Will be Coming but Name and Documents Not showing in Screen.

And One more thing if I Upload Image, then Image name will automatically set in name field.

And I am uploading My OML also, Check Logic i created.

Please Help Me on this Task.

GetMultipleDocuments.oml
2023-03-12 08-39-51
Iheb Maatali Riahi
Solution

Ok, I didn't understand why the previous solution didn’t match something, but I'm following your specific needs. I inspected your OnAfterFetch function, and I found the issue: 

when you change an element inside another file input field, you append it to MultipleDocument and assign NullData to TemporaryDocuments : 


After that, in the Save button, you are fetching data from TemporaryDocuments instead of MultipleDocuments : 

Also you need some Updates Here :
-

GetMultipleDocumentsByCustomerId.List.Current.MultipleDocuments.FileName and 

GetMultipleDocumentsByCustomerId.List.Current.MultipleDocuments.FileContent




You need to keep the ID for the update, as mentioned by the others in this discussion.
Also you need to Manage Large Images and 
I hope this helps and meets your needs. 

2022-12-22 10-00-39
Beatriz Sabino

Hi Sagar,

In the After Fetch Action of your GetMultipleDocumentsByCustomerId aggregate, simply map the result to your local list.

Also pay attention to the warnings list. Your SaveOnClick action should only have one server action. You should perform all of this logic in one server action.

The reason, when you upload an image the of the customer is changed, is because in your upload widget you are using the Customer Name as the File Name.

Create two local variables to use in the widget, and then use its value to save the image in your Customer Entity.


Below is the updated .oml.

GetMultipleDocuments_updated.oml
2025-10-09 13-52-02
Sagar Andyal

Hi @Beatriz Sabino

Name field is working properly. And Record will be creating successfully, but I need to edit existing record.

After I click Name.

2022-12-22 10-00-39
Beatriz Sabino

Why can't you edit the record? Just change the information and click save again, are you referring to the documents? If you change a document the local list is not updated?

2025-10-09 13-52-02
Sagar Andyal

HI @Beatriz Sabino ,

Ya I am able to edit the record, the documents should display in same place where we uploaded that image. Like AdharCard in Upload2 Widget,  PanCard in Upload3, Driving Licence in Upload4 and other documents should display in Local List.

After I get the all information properly, after Ill create 1 one column for edit document in Local list. 

2024-10-16 11-59-48
Nick Vandebriel

Hello Sagar,


The reason the name changes when you upload your image is because you have the file name property set to that field. You could leave it empty.

For the list issue, you are setting your tempory Documents instead of the MultipleDocuments. Try something like the assign below to fill up your list.


Hope this helps,


Nick


2025-10-09 13-52-02
Sagar Andyal

Hi @Nick Vandebriel

Record is creating, but I need to edit existing record.

And Thank you for point the nameing issue.

2024-12-27 06-34-00
Suryanarayana Vundru

Hi @Sagar Andyal ,

As you are passing NullIdentifier as Id to the server actions in SaveOnClick for updating the record(s) you are getting error/exception.

For updating documents provide a update button beside remove button and pass the current document id for updating the files of documents list(you can use a popup for showing the document upload widget) and you have to show the file upload  widgets only if the  CustomerId = NullIdentifier and don't show the update button in the document list 



(Reply Updated)




Hope it will resolve your issue.


Regards,

Surya.

2023-03-12 08-39-51
Iheb Maatali Riahi

Hi  @Sagar Andyal

I have made some changes to your OML. Please review the attached file below.
Here is the link to the working example.

Have a great day! 

GetMultipleDocuments - Updated.oml
2025-10-09 13-52-02
Sagar Andyal

Hi @Iheb Maatali Riahi ,

Your Logic is different that mine, Could You please go through my Logic.

Hear, In this screen not getting other Documents in Local List.

Ill Attaching My Oml file.

GetMultipleDocuments.oml
2023-03-12 08-39-51
Iheb Maatali Riahi

Link Working fine! Please avoid using large images to prevent timeout errors. 

-> I’m going through your logic and have made some refactors to resolve the issues. 

2025-10-09 13-52-02
Sagar Andyal

You made changes in On after fetch action Right.

you used list filter for that and ill used assign for upload widget and for the local list i used append.

Ill Uploaded My oml file Just check on that.

File Name and File Content Will not be appearing.

2023-03-12 08-39-51
Iheb Maatali Riahi
Solution

Ok, I didn't understand why the previous solution didn’t match something, but I'm following your specific needs. I inspected your OnAfterFetch function, and I found the issue: 

when you change an element inside another file input field, you append it to MultipleDocument and assign NullData to TemporaryDocuments : 


After that, in the Save button, you are fetching data from TemporaryDocuments instead of MultipleDocuments : 

Also you need some Updates Here :
-

GetMultipleDocumentsByCustomerId.List.Current.MultipleDocuments.FileName and 

GetMultipleDocumentsByCustomerId.List.Current.MultipleDocuments.FileContent




You need to keep the ID for the update, as mentioned by the others in this discussion.
Also you need to Manage Large Images and 
I hope this helps and meets your needs. 

2025-10-09 13-52-02
Sagar Andyal

Hi @Iheb Maatali Riahi ,

Thank you so much for your help with this task. I couldn't have done it without you.


2023-03-12 08-39-51
Iheb Maatali Riahi


You're very welcome! I'm glad I could help. Have a great day! 

2025-04-14 11-22-14
Aditi Saraswat

Hi @Sagar Andyal,

I have updated the OML.

One suggestion: please consolidate all the server actions into a single server action, rather than calling multiple server actions from the client action. Calling server actions directly from a client action is not considered best practice and may lead to performance issues in the future. 

Hope this will help.

Thanks

GetMultipleDocuments-Updated.oml
2025-10-09 13-52-02
Sagar Andyal

Hi @Aditi Saraswat ,

I'll Appreciate For your Suggestion.

But I am New To the Outsystems, I Don't know how to call multiple server action in Single server action could you please elaborate In Simple and easy to understand. 

 

2025-04-14 11-22-14
Aditi Saraswat

Hi @Sagar Andyal,

I have updated the OML.

Feel free to review it, and let me know if you encounter any issues during implementation. 

Thanks.

GetMultipleDocuments-Updated.oml
2025-10-09 13-52-02
Sagar Andyal

Hi @Aditi Saraswat ,

Thank you so much for the help.

Ill Mentioned my issue in above comment.

2025-04-14 11-22-14
Aditi Saraswat

I've updated the solution to address your issue as well—could you please take a look? 

2025-10-09 13-52-02
Sagar Andyal

Ya But You used List filter for that and Ill used append for Multiple Documents Local List.

My Logic is different and i am getting Adharcard, pancard, and drivingLicence also but i am not getting other documents in local List.

Like ill mentioned above image. and also i uploaded my oml file check the logic i used.

2025-04-14 11-22-14
Aditi Saraswat

I have updated your OML logic.

Please try and let me know if you encounter any issues during implementation. 

GetMultipleDocumentsUpdated.oml
2025-10-09 13-52-02
Sagar Andyal

Logic is same but still i am not getting file name and filecontent In local list.

Look at the Local list.

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