Populate Short Description with Form Variable Values in requested item record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2023 06:55 AM
Hi,
I've set up a catalog item named 'change site' that includes fields like 'version,' 'unit,' and 'system.'
Additionally, I've created a business rule that, upon saving the record, should populate the 'short_description' field of the requested item with a string composed of the chosen values in the mentioned fields - 'chosen version / chosen unit / chosen system/ request name', but it doesnt work.
this is the business rule:
However, I'm encountering some challenges with this setup. Could someone please provide guidance or suggestions?
Thanks,
Sahar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2023 07:21 AM
Hi @Sahar_Kaizer ,
You can try this to see if it is returning the correct values :
var gr = new GlideRecord('sc_item_option_mtom');
gr.addQuery('request_item',<RITM sysid>); // this will give you list of all the variables
gr.query();
while(gr.next())
{
var vargr = new GlideRecord('sc_item_option');
vargr.addQuery('sc_item_option', <sysid of variable value you need>);
vargr.query();
while(vargr.next())
{
gs.info('Value of variable is ' + vargr.value);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2023 07:21 AM - edited 12-27-2023 07:27 AM
Hi @Sahar_Kaizer, You need to use current.variables.<yourVariableName> in BR (sc_req_item) to retrieve the variable value. Can you try the below script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2024 10:57 PM
Hi @Sahar_Kaizer , Please try the below code:
Table - Requested Item(sc_req_item)
When to Run - Before Insert
condition: item is change site
Script -
Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.
Thanks & Regards
Jyoti Jadhav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2024 11:50 AM
hi @Sahar_Kaizer ,
I don't think that you need to write the complex logic . I have tried in PDI and below code works for me:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2024 11:57 AM
- I have written below code in PDI and it works for me.
BR Type: before insert. Condition you may defined and restrict to run on particular catalog item.