here i need to update a record in incident with help of widgets .
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2024 02:42 AM
with help help of widget , i wrote a server script and client contoller. but im getting output as a incident created again newly with having any short desc. so i will provide a scripts for both server script and controller
server script:-
if (action == 'update') {
var incident = new GlideRecord("incident");
incident.addQuery('number', input.incident.number);
incident.query();
while (incident.next()) {
if (input.incident.number == incident.number) {
// input.number="updateIncident"
incident.short_description =input.shortDescription;
incident.update();
response.short_description = incident.update();
response.success = !!response.short_description;
response.message = response.success ? 'Incident created successfully' : 'failed to create incident';
}
}
gs.log("print : " + incident.update());
============================================
client controller:-
$scope.updateIncident = function(){
var inciUp={
// back-end name : $scope.ng-model Name.
short_description:$scope.short_description,
};
$scope.server.get({
action: 'update',
short_description:inciUp
}).then(function(response){
$scope.message = response.message;
if(response.success){
// given value of a priority = updated value of a priority.
$scope.short_description= response.short_description;
}
});
};
input:- when we pass a incident number then it verifies that record and then update the short desc
my output: but im getting as a creating record newly
so please try to help me
0 REPLIES 0