I want to create a new record using a workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2017 08:52 AM
Using a workflow, I want to create a new record on a table. However, this is creating multiple records. In addition,
I would also like to create a new record related record in the related table of proc_po_item.
var gr = new GlideRecord('proc_po');
gr.query();
gr.initialize();
gr.vendor_account = current.variables.u_first_name; //variables.u_first_name is the field from the variable this should be
gr.number = current.variables.u_last_name;
gr.insert();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2017 11:22 AM
Where is this business rule defined? Product catalog refers to a requested item?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2017 06:45 PM
Thanks a lot Pradeep,
I am using scripted workflow, rather than a BR. I figure scripted workflow would be easy for other people to maintain.
I used the script below to output the Item being requested by the user
...
var gr = new GlideRecord('proc_po');
...
....
gr.short_description = current.cat_item.name; (the value was displaed on the Short Description field)
....
....
However, when I used the code below as a quick test,
var gr = new GlideRecord('proc_po_item');
.....
.....
gr.setValue('product_catalog', current.short_description);
....
...
The value did not did not show in the reference box

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2017 07:06 PM
Hello Lexy,
You can only populate the reference field with the display value. What field product catalog refers to?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2017 10:36 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2017 11:35 AM
Hi Lexy,
If you are simply creating a record. you don't need gr.query(), that's used to read records.
Try this alone:
var gr = new GlideRecord('proc_po');
gr.initialize();
gr.vendor_account = current.variables.u_first_name; //variables.u_first_name is the field from the variable this should be
gr.number = current.variables.u_last_name;
gr.insert();