
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2020 09:35 PM
Hi guys, could you help me, by default, when i try to order from catalog item field "requested for" filling by logged in user, i would like to change it from a variable ?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2020 09:39 PM
Create a before business rule on table sc_request with below details.
Table: sc_request
When to run: Before
Insert: Checked
Advanced > Condition : Empty
Script:
var grRITM = new GlideRecord('sc_req_item');
grRITM.addQuery('request', current.sys_id);
grRITM.query();
while (grRITM.next()) {
if (!JSUtil.nil(grRITM.variables.requested_for)) { //assuming requested_for is the name of your catalog variable. Replace this exactly with the name of catalog variable you have.
current.requested_for = grRITM.variables.requested_for; /assuming requested_for is the name of your catalog variable. Replace this exactly with the name of catalog variable you have.
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-31-2020 09:44 PM
I recommend using business rule if this is for all catalog items. Having a run script will require you to modify the workflows for all catalog items. Why modify all workflows when this can be done via a single BR 🙂
- Pradeep Sharma