How to call embedded widget client function from parent custom widget client script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2020 01:28 PM
Requirement: i want to add a custom UI button on the page that displays with oob form widget on page. If i make changes to the form and click the custom Update button the form changes should be saved.
Without cloning i want the ability to use the oob form widget and call its client function "triggerUIAction" from my custom widget script. What suggestion on best way to do it:
Option 1: embedded the form widget inside my custom widget. But then how would i call the "triggerUIAction" function?
Option 2: I do not have much knowledge on this but is there a way to achieve this using dependencies, UI scripts or angular providers to work with oob form widget?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2020 01:35 PM
AngularJS hierarchy is based on scopes. Child scopes have access to their parent scopes, but parent scopes don't have access to their children's scopes. Normally, the way to do what you're referring to is with events (see https://docs.angularjs.org/api/ng/type/$rootScope.Scope [$on, $emit, $broadcast]). Since in the service portal this wouldn't be possible without cloning the widget (which is recommended NOT to do for the OOB form widget), I would recommend just copying and pasting the "triggerUIAction" function into your widget's controller.