SC Catalog Item widget submission question

yundlu316
Kilo Guru

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?

5 REPLIES 5

actually the submission is happening inside the IF statement:

if (!g_form.submit()) {

the !   (not) executes the following code if g_form.submit()  had an error....

(kinda sneaky)