based on variable value is not equal to,another variable table level field display error message.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2023 09:40 PM
onevariable value is not equal to anothe variable table field value on that time display error i tried with below widget but no luck please check and let me know my mistake.
Client controller:
api.controller = function($scope, $rootScope, spSCNavStateManager, spUtil) {
/* widget controller */
var c = this;
$scope.valideProject = false;
$scope.valideDate = false;
$scope.onLoad = function() {
var requested_for1 = $scope.page.g_form.getValue('hardware_asset');
if (requested_for1 != '' && requested_for1 != undefined)
$scope.check_project_code();
$rootScope.$on("field.change", function(evt, parms) {
if (parms.field.name == 'hardware_asset') {
$scope.check_project_code();
}
});
};
$scope.check_project_code = function() {
c.server.get({
action: 'check_project_code',
code: $scope.page.g_form.getValue('hardware_asset')
}).then(function(response) {
if (response.data.message == $scope.page.g_form.getValue('model_item1')) {
$scope.valideProject = true;
} else {
$scope.page.g_form.clearValue('hardware_asset');
$scope.page.g_form.showFieldMsg('hardware_asset', 'Please, select the computer model equal to the service assigned.', 'error');
$scope.valideProject = false;
}
});
};
};
server script:
(function() {
/* populate the 'data' object */
/* e.g., data.table = $sp.getValue('table'); */
data.sc_cat_item = $sp.getGuide(data.sys_id, true, false);
data.sys_id = $sp.getParameter("sys_id");
data.groupit = 'false';
if (input.action == 'check_project_code') {
data.check_code = false;
var ga=new GlideRecord('alm_hardware');
ga.addQuery('sys_id',input.code);
ga.query();
if(ga.next()){
// var mani=ga.getValue('u_type_of_license');
data.message = ga.model.u_cg_usage_category;
}}}
)();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2023 10:30 PM
Hi @mani55
I noticed you're tinkering with a Catalog Item form. I'm curious why a Catalog Client Script isn't being employed.
Is there a particular reason for choosing to modify a widget instead?
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2023 11:00 PM
because my organization policy try to minimizing the client script they support only widgets