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-21-2017 07:11 AM
Thanks a lot Chuck. It worked. However, the variables didn't populate reference fields. Was wondering how I could achieve that....

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2017 11:38 AM
Hi Lexy,
Please remove gr.query();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2018 07:43 AM
Hello all, similar to this, from within a workflow, I am having an issue where I cannot get the RITM number into the new created story. Everything else is working fine but just one line of code I am having trouble with. I am not sure what am I missing. My code is as follows:
createStory();
function createStory() {
var rmStory = new GlideRecord("rm_story");
rmStory.initialize();
rmStory.description = current.variables.u_er_description;
rmStory.u_requested_item = current.number; // where 'u_request_item' is a reference field on the rm_story table and current.number is the RITM number that I want to get there.
rmStory.u_rm_story_use_case = current.variables.u_er_use_case;
rmStory.insert();
}
Thanks for all the help.