- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2022 07:39 AM - edited 10-06-2022 07:41 AM
Hi,
I have created a list field(BU with options a,b,c,d) in the sn_gf_goal_target table.
and another string field(Selected BU) in the sn_gf_goal table.
I want to copy the value of List from the Target table to Goal table.
Suppose Goal table has 3 Target records(1,2,3), and
1 is selected a,b
2 is selected c,d
3 is selected a,d.
Then in the selected BU all a,b,c,d will populate
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2022 11:03 PM
Hi,
then update as this
var a = current.u_bu.getDisplayValue();
gs.addInfoMessage(a);
var gr = new GlideRecord('sn_gf_goal');
gr.addQuery('sys_id', current.goal);
gr.query();
if (gr.next()) {
gr.u_se_bu = gr.u_se_bu + ',' + a;
gr.update();
}
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2022 07:46 AM
Hi @Samiksha2
You can achieve this by writing after insert/update BR on target table.
Have you tried anything?
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2022 07:49 AM
Yes I tried,
var a = current.u_bu.getDisplayValue();
gs.addInfoMessage(a);
var gr = GlideRecord('sn_gf_goal');
gr.addQuery('name', current.goal);
gr.query();
if (gr.next()) {
gr.u_se_bu.setValue(a);
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2022 07:51 AM
Hi,
how will you determine which record in Goal to update? any reference field on Goal which refers Target table?
what script did you try so far and where are you stuck?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2022 07:55 AM
var a = current.u_bu.getDisplayValue();
gs.addInfoMessage(a);
var gr = GlideRecord('sn_gf_goal');
gr.addQuery('name', current.goal);
gr.query();
if (gr.next()) {
gr.u_se_bu.setValue(a);
gr.update();
}