77
Views
6
Comments
Can I change a Resource via a client/server action?
Question
Application Type
Reactive
Service Studio Version
11.54.38 (Build 63033)

I have some resources loaded into studio, a .json and four .bin files. I want a user to be able to replace these files with updated versions as they need to. Is this possible to change a resource's source file from a client/server action?

2023-12-16 19-57-03
Sanjay Kushwah

Hi @Michael Marlowe,

OutSystems doesn't support directly replacing resource files at runtime from client/server actions for security and integrity reasons.


Additional :

If you have physical application directory. for Create, Delete and List directories. you can use file system forge component. 

https://www.outsystems.com/forge/component-overview/68/filesystem

Thanks,

Sanjay Kushwah

UserImage.jpg
Michael Marlowe

Thanks @Sanjay Kushwah. The json file is a manifest that references the paths of the .bin files that an external script needs as an input parameter. I could make the .bin's into attributes on a new DB entity, but injecting the JSON as json and not text, I don't see a way to do that with OutSystems.

I need to provide the JSON as an attribute on an HTML tag, but that'll come out as text if I put the literal object, and if I build the manifest into a DB entity, that'll be text as well. Whereas with having it as a resource I can provide the path for the json file as the attribute. 

Any suggestions?

2023-12-16 19-57-03
Sanjay Kushwah

You want to Add JSON as Attribute in html tag or a Value of a attribute ?

UserImage.jpg
Michael Marlowe

As the Value, correct. I was hoping to be able to have the people who wrote the firmware (.bins and .json manifest) could be able to update the manifest and .bins with their newest version, but I think it's looking like we'll need to do a manual update on the hosted resources within studio when they make a new version. 

2023-12-16 19-57-03
Sanjay Kushwah

well I didn't understand properly what you want to achieve exactly.

But if you want to add JSON as a value of attribute in a HTML tag you can use Javascript.

Firstly Convert your JSON String to JSON object using JSON.parse() function then use setAttribute("AttributeName","Value") function to set a attribute of your HTML tag.


UserImage.jpg
Alexandre Yip

Hi Michael, 

Check out here a suggestion for your request 

https://www.outsystems.com/forums/discussion/45909/is-it-possible-to-add-remove-files-from-resource-folder-in-run-time/


Hope that it helps you 

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