- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2022 09:41 PM
Hi all,
Thanks in advance
im looking to update Asset field (Assigned to) with current requester from Service Portal,
so far i only use one variable (asset_for_me) and of course Assigned to is depending on current state need change it first automaticaly
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2022 07:35 AM
update as this
var assetGuid = current.variables.asset_for_me;
var almAsset = new GlideRecord("alm_asset");
if (almAsset.get(assetGuid)) {
almAsset.install_status = "1";
if(current.variables.requested_for)
almAsset.setValue('assigned_to', current.variables.requested_for);
else
almAsset.setValue('assigned_to', current.request.requested_for);
almAsset.update();
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2022 07:35 AM
update as this
var assetGuid = current.variables.asset_for_me;
var almAsset = new GlideRecord("alm_asset");
if (almAsset.get(assetGuid)) {
almAsset.install_status = "1";
if(current.variables.requested_for)
almAsset.setValue('assigned_to', current.variables.requested_for);
else
almAsset.setValue('assigned_to', current.request.requested_for);
almAsset.update();
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2022 12:56 AM
Hi Ankur,
this is work, Thanks !
my question is, since asset have different model category so field state (install_status) and assigned_to here on script is based on asset form? Or each model category form that contain assigned_to? because it didn't mention alm_hardware but yes, stright to the field on form.
Im sorry still new on this, Thanks!