- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 12:56 PM
Hi Community,
Good Day!
There is a catalog item have a list collector type and links with Hardware [alm_hardware] and I want to update it's state. if I select one record, it updates the record of the table. But if I select multiple records, these are not updating on Hardware. I want to update multiple records at one time.
this is the list collector:
this is BR on table:
var gr=new GlideRecord('alm_hardware');
gr.addQuery('sys_id',current.variables.show_asset_tag);
gr.query();
if(gr.next()){
gr.install_status=current.variables.state;
gr.update();
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2023 07:49 AM
Oh sorry got it !! we are doing (if(gr.next)) we need to do like this(while(gr.next()))
Please try this :-
var gr=new GlideRecord('alm_hardware');
gr.addQuery('sys_id', 'IN', current.variables.show_asset_tag);
gr.query();
while(gr.next()){
gr.install_status=current.variables.state;
gr.update();
}
if not work then try by replacing 'sys_id' with 'display_name'.
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
Regards,
Ranjit Nimbalkar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 01:04 PM
Hi @DEV976
Try this script:-
var gr=new GlideRecord('alm_hardware');
gr.addQuery('sys_id', 'IN', current.variables.show_asset_tag);
gr.query();
if(gr.next()){
gr.install_status=current.variables.state;
gr.update();
}
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
Regards,
Ranjit Nimbalkar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 01:25 PM
Hi @Ranjit Nimbalk, thanks for your reply but it is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-07-2023 01:49 PM
Hi @DEV976
Please try this :-
var gr=new GlideRecord('alm_hardware');
gr.addQuery('display_name', 'IN', current.variables.show_asset_tag);
gr.query();
if(gr.next()){
gr.install_status=current.variables.state;
gr.update();
}
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
Regards,
Ranjit Nimbalkar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2023 07:44 AM
Hi @Ranjit Nimbalka, i've try this one too, but the result is same