Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2023 02:11 AM
I am trying to update comments in worknotes of existing problem record. Using the below posted command.
var problem=new GlideRecord('problem');
problem.addQuery('cmdb_ci',ci);
problem.addActiveQuery();
problem.query();
if(problem.next())
{ problem.work_notes="Problem Reviewed"; //this is not working
problem.update();}
This query is not working, not able to update worknotes in existing problem record with "problem.work_notes="Problem Reviewed";".
But when I am trying to create a new problem record with below query, same command is working.
problem.initialize();
problem.assignment_group=grp;
problem.work_notes = "Problem Created & Reviewed"; //it is working
problem.insert();
problem.assignment_group=grp;
problem.work_notes = "Problem Created & Reviewed"; //it is working
problem.insert();
Can anyone please check and update as how to update worknotes in existing problem record
Solved! Go to Solution.
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2023 02:53 AM
Just Try This one:
BR for incident table
var prblm=new GlideRecord('problem');
prblm.addActiveQuery();
prblm.addQuery('cmdb_ci',current.cmdb_ci);
prblm.query();
while(prblm.next()){
prblm.work_notes='Problem Reviewed';
prblm.update();
}
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2023 02:21 AM
Hi,
Please let us know what is the value of ci i.e.
problem.addQuery('cmdb_ci',ci);
Regards,
Satyapriya
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2023 02:35 AM
CI is a variable -
var ci = current.cmdb_ci; //it is in incident table, taking CI from Incident, and then checking if there is already a problem records in problem table then update the work notes, else create a new problem record. script is working fine except one thing- that we are not able to update worknotes in exisiting problem record..
to test, I even published a info message with problem.number.. even that is working.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2023 02:53 AM
Just Try This one:
BR for incident table
var prblm=new GlideRecord('problem');
prblm.addActiveQuery();
prblm.addQuery('cmdb_ci',current.cmdb_ci);
prblm.query();
while(prblm.next()){
prblm.work_notes='Problem Reviewed';
prblm.update();
}