- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2022 06:23 AM
I have a text field variable in catalog .
I want to set the text field value to the parent field of cmdb relationship table which is a reference field using flow designer.
Can someone suggest some solution .
Urgent requirement
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2022 07:20 AM
Hi,
not possible directly. but why to have it as text variable. If user doesn't give valid name the parent field cannot be set.
parent field is reference to cmdb_ci table so you will have to set sys_id in that field only
you will have to use inline f(x) script
script would look something like this
I assume user would enter name of CI which can be found in cmdb_ci table
var sysId = fd_data.trigger.current.sys_id;
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id', sysId);
gr.query();
if(gr.next()){
var name = gr.variables.enter_name;
var rec = new GlideRecord('cmdb_ci');
if(rec.get('name', name)){
return rec.getUniqueValue();
}
}
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
08-17-2022 06:26 AM
Hi
unfortunately it is not really clear what your issue is.
Please provide more details and especially screenshots, so we can better understand your situation and help you accordingly.
Kind regards
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2022 06:34 AM
Hello Maik
I have added the attachment
Can you let me know how can I do it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2022 06:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2022 07:20 AM
Hi,
not possible directly. but why to have it as text variable. If user doesn't give valid name the parent field cannot be set.
parent field is reference to cmdb_ci table so you will have to set sys_id in that field only
you will have to use inline f(x) script
script would look something like this
I assume user would enter name of CI which can be found in cmdb_ci table
var sysId = fd_data.trigger.current.sys_id;
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id', sysId);
gr.query();
if(gr.next()){
var name = gr.variables.enter_name;
var rec = new GlideRecord('cmdb_ci');
if(rec.get('name', name)){
return rec.getUniqueValue();
}
}
regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader