SC Catalog Item widget submission question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2020 11:24 AM
Our team cloned the ootb SC Catalog Item widget and is wondering how this widget actually submits the record producer. We see the client script for triggerOnSubmit, but don't see how this onClick function actually submits the record producer.
$scope.triggerOnSubmit = function(timeout) {
if ($scope.options.isServiceWorkspace && $window.frameElement) {
var workspaceParams = {};
workspaceParams.sysparm_parent_table = $window.frameElement.getAttribute('parent-table');
workspaceParams.sysparm_parent_sys_id = $window.frameElement.getAttribute('parent-sys-id');
$scope.data.workspaceParams = workspaceParams;
}
$scope.data.sc_cat_item.item_action = "order";
$scope.data.sc_cat_item.quantity = c.quantity;
$scope.$evalAsync(function () {
if (g_form) {
$scope.submitting = true;
if (!spScUtil.isRegexDone($scope.data.sc_cat_item._fields)) {
$scope.submitting = false;
$scope.validating = true;
} else if (!g_form.submit()) {
timeout = timeout || 1000;
$timeout(function () {
$scope.$broadcast('$sp.service_catalog.form_submit_failed', {action_name: 'submit'});
}, timeout);
}
}
})
return false;
}
Can anyone provide some direction on where the actual submission is being called?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2020 11:32 AM
I believe it's done through g_form.submit(). Try a code search for that and see if you get a bit more context.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2020 11:36 AM
we were kinda thinking along those lines. We see (!g_form.submit())...does if(g_form) means submit?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2020 12:01 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2020 01:01 PM
interesting....do you happen to know where all the validations occur (e.g. making sure mandatory fields are filled in, etc.?)
We want to clone this ootb widget and then flag true when all the valiations return true and vice versa. We have a custom submit button and want those rules to trigger and prevent a submission if any of the rules are not fulfilled...