Service Portal widget event handler

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2018 12:26 PM
I want to add an event handler for when the form has been loaded so I added following in the Client script in a new widget.
$rootScope.$on('spModel.gForm.initialized', function (e, gFormInstance) {
console.log('In spModel.gForm.initialized');
});
I have also tried
$scope.$on('spModel.gForm.initialized', function (e, gFormInstance) {
console.log('In spModel.gForm.initialized');
});
But nothing happens what the pages is loaded.
The weird thing is that I have another widget (more complex one with both client and server scripts) where I use the exact same code and in that widget it works fine.
Of course both $scope and $rootScope is injected with
function($scope, $rootScope)
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-20-2018 11:55 PM
Hi,
i am not familiar with this but adding my points below
$rootScope.$emit('spModel.gForm.initialized', id);
I believe we need to send an event from another widget like the above to make your widget to listen that event.
or
if (spModel.gForm.initialized) is a OOB event that is triggered during form initialization, then ignore the above !!
Thanks,
satheesh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2018 12:02 AM
The event is an OOB event.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-05-2019 08:49 PM
What about spModel.gForm.env.created?
It appears in the out of the box form widget, as does spModel.gForm.initialized...
$scope.$on('spModel.gForm.env.initialized', function (e, gFormInstance){
initForm(gFormInstance)
});
$scope.$on('spModel.gForm.env.created', function (e, gFormInstance){
initForm(gFormInstance)
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2020 06:45 AM
Did you find a solution for this?
When I reload my page, I don't see the form rendered either.
thanks
kalhee