RE: Custom Fields in User & Organization Edit Forms

Dorian Penot, modified 6 Years ago. Junior Member Posts: 25 Join Date: 3/14/19 Recent Posts
Hi ! 

I m working on a full OSGI liferay using service builder. I need to add customs fields in organization and user edit pages. I found on this forum that hook is not possible with service builder. The problem is that i need to add a dropdown list populated with all users, in the Organization Edit Form. I have no idea how to populate my dropdown list, is there a way to use hook in Liferay 7.1 and service Builder ? Is there a way to populate it directly from the service builder ? Is there a way to had a new type of custom filed ? 
thumbnail
Christoph Rabel, modified 6 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
We usually populate those fields through rest services.

It is pretty simple. You create a new rest module with the functions you need (e.g. /getUsers). Then you add javascript code to populate the dropdown with the data from the rest module.
Dorian Penot, modified 6 Years ago. Junior Member Posts: 25 Join Date: 3/14/19 Recent Posts
Thanks for you answer, but the problems is still the same, where do I put the javascript code ?
thumbnail
Christoph Rabel, modified 6 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
You would need to use a fragment to change the relevant jsp/jsps. It works similar to hooks.
https://dev.liferay.com/de/develop/tutorials/-/knowledge_base/7-0/overriding-a-modules-jsps
Dorian Penot, modified 6 Years ago. Junior Member Posts: 25 Join Date: 3/14/19 Recent Posts
I see, i was not sure about the fragment because it can make things unstable when the host module is upgraded. I will try this thank you !