Sitefinity 11.0 Create AdminApp Extension custom field with

Posted by emanuel.becker@aa-g.de on 27-Feb-2020 16:29

Hello everybody,

i would like to create two custom fields in "Sitefinity" (version 11.0) The first custom field should be the title. The second custom field should be a field with related data (Related-Product).

The fields have already been created with the Module Builder.

I want to have a possibility in the backend to click on an additional button which will save the product title from the related product into the custom field "Title".

Now I've seen that this can be done by extending the AdminApp of Sitefinity. https://www.progress.com/blogs/how-to-extend-the-new-sitefinity-admin-app

Now we come to my problem. Progress has designed this to have one Angular component per custom field. So I have to define two custom fields in my AdminApp extension, although I only want to read from the second field.

I only have access to the value of the single field from my Angular component and not to the whole model.

Since I now have to create the field with the related data as a custom field, I would need the code for a custom field that is a related data field as a data type.

Or is there another way to do this?

All Replies

Posted by myordano on 05-Mar-2020 12:32

Hi,

The thing you are trying to achieve should be possible by using the commands-extender by following the examples here. You can make your own command (like the print-preview in the example) and when overriding the execute method you will receive the ExecutionContext object which holds your dataItem (along with its related fields). From there you have an access to the title of your related product. You can make a service which your custom title component and command can inject and communicate through it. You can just next the value in a ReplaySubject from your command and subscribe in your component to it. What is left is for you to call the writeValue function and it should be visualized.

Regards

This thread is closed