{% form_theme form with ['OroFormBundle:Form:fields.html.twig', _self] %}
<div class="widget-content">
    {% if saved %}
        <script type="text/javascript">
        require([
            'orotranslation/js/translator',
            'oroui/js/widget-manager',
            'oroui/js/messenger'
        ],
        function(__, widgetManager, messenger) {
            widgetManager.getWidgetInstance({{ app.request.get('_wid')|json_encode|raw }}, function(widget) {
                messenger.notificationFlashMessage('success', __('oro.security.action.shared'));
                widget.remove();
            });
        });
        </script>
    {% else %}
        {% if not form.vars.valid and form.vars.errors|length %}
            <div class="alert alert-error">
                <div class="message">
                    {{ form_errors(form) }}
                </div>
            </div>
        {% endif %}
        <div class="form-container">
            <form id="{{ form.vars.name }}" action="{{ formAction }}" method="post">
                <fieldset class="form-horizontal">
                    {{ form_rest(form) }}
                    <div class="widget-actions form-actions" style="display: none;">
                        <button class="btn" type="reset">{{ 'Cancel'|trans }}</button>
                        <button class="btn btn-primary" type="submit">{{ 'Apply'|trans }}</button>
                    </div>
                </fieldset>
            </form>
            {{ oro_form_js_validation(form) }}
        </div>
    {% endif %}
</div>

{% form_theme form with ['OroFormBundle:Form:fields.html.twig', _self] %}
<div class="widget-content">
    {% if saved %}
        <script type="text/javascript">
        require([
            'orotranslation/js/translator',
            'oroui/js/widget-manager',
            'oroui/js/messenger',
            'oroui/js/mediator'
        ],
        function(__, widgetManager, messenger, mediator) {
            widgetManager.getWidgetInstance({{ app.request.get('_wid')|json_encode|raw }}, function(widget) {
                messenger.notificationFlashMessage('success', __('oro.security.action.shared'));
                widget.remove();
                mediator.execute('refreshPage');
            });
        });
        </script>
    {% else %}
        {% if not form.vars.valid and form.vars.errors|length %}
            <div class="alert alert-error">
                <div class="message">
                    {{ form_errors(form) }}
                </div>
            </div>
        {% endif %}
        <div class="form-container">
            <form id="{{ form.vars.name }}" action="{{ formAction }}" method="post">
                <fieldset class="form-horizontal">
                    {{ form_rest(form) }}
                    <div class="widget-actions form-actions" style="display: none;">
                        <button class="btn" type="reset">{{ 'Cancel'|trans }}</button>
                        <button class="btn btn-primary" type="submit">{{ 'Apply'|trans }}</button>
                    </div>
                </fieldset>
            </form>
            {{ oro_form_js_validation(form) }}
        </div>
    {% endif %}
</div>

Add Shared link to entity view page - refresh page after apply share records
AEIV-147: Add Shared link to entity view page
- refresh page after apply share records
