- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-07-2025 05:51 AM
Hey,
Happy Monday!!
I need some help. In service now I have created a reference field name assets that is coming from hardware table on request_item, now I want the same field on sc_task table with same data from RITM asset field.. But it should be read only. (the asset field on sc_task should only pull data of requested.item asset field)
How I can achieve this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-07-2025 07:13 AM
Hi @AbdulrehmanTAbdulrehmanT,
Hope you're doing well!
You can dot walk to get the field on to the Catalog Task table (from RITM table), please check the following example that I tried
I created a field 'Related Asset' on RITM table/form
I went to the form layout of Catalog Task(sc_task), select the Requested Item field, expand selected reference field and dot walk to the exact field on the reference field's table field, in my case I dot walked from Requested Item field on Catalog Task to Related Asset field on RITM table
ā
Best Regards,
Sharif
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-07-2025 11:01 AM
I have found the solution, created a business rule on requested_item by creating a reference field(alm_hardware) on both table i.e. sc_task, sc_req_item
Before - Insert/update
Condition - Assets<< changes
(function executeRule(current, previous /null when async/) {
var taskGR = new GlideRecord('sc_task');
taskGR.addQuery('request_item', current.sys_id); // Link to RITM
taskGR.query();
while (taskGR.next()) {
taskGR.u_ritm_assedt = current.u_asset; // Copy the asset from RITM
taskGR.update(); // Save changes
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-07-2025 11:04 PM
The no code solution would have been a dotwalked field, so it's always exactly the same and only show it on the form for the items you want it on (ui policy). You now have 2 custom fields that need to be in sync, instead of handling everything through one field, without any scripts.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-07-2025 07:13 AM
Hi @AbdulrehmanTAbdulrehmanT,
Hope you're doing well!
You can dot walk to get the field on to the Catalog Task table (from RITM table), please check the following example that I tried
I created a field 'Related Asset' on RITM table/form
I went to the form layout of Catalog Task(sc_task), select the Requested Item field, expand selected reference field and dot walk to the exact field on the reference field's table field, in my case I dot walked from Requested Item field on Catalog Task to Related Asset field on RITM table
ā
Best Regards,
Sharif
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-07-2025 08:11 AM
yeah it works but i only wants to show the asset field on some items, not all
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-07-2025 11:01 AM
I have found the solution, created a business rule on requested_item by creating a reference field(alm_hardware) on both table i.e. sc_task, sc_req_item
Before - Insert/update
Condition - Assets<< changes
(function executeRule(current, previous /null when async/) {
var taskGR = new GlideRecord('sc_task');
taskGR.addQuery('request_item', current.sys_id); // Link to RITM
taskGR.query();
while (taskGR.next()) {
taskGR.u_ritm_assedt = current.u_asset; // Copy the asset from RITM
taskGR.update(); // Save changes
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā07-07-2025 11:04 PM
The no code solution would have been a dotwalked field, so it's always exactly the same and only show it on the form for the items you want it on (ui policy). You now have 2 custom fields that need to be in sync, instead of handling everything through one field, without any scripts.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark