need to create a custom table record from catalog item workflow

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2019 03:39 AM
Hi All,
I have a requirement to create a record of custom table through catalog item, Since i need to have approvals and custom tasks generated accordingly.
Thanks
- Labels:
-
Field Service Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2019 04:19 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2019 10:27 PM
HI Hardit,
Creating the WF on the custom table still created the catalog tasks since i need to have tasks assigned to groups, and WF gives only the option of catalog tasks to be generated.
My requirement is to create custom table records as tasks.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2019 04:29 AM
Hi
Yes this is possible. I have done similar. You create your item and gather your variables and then create a workflow for it.
You can then set approvals etc.
In my example I had 1 workflow on the cat item - this created an item and set some details for notification purposes and approvals then created record on the custom table using the variables from the item.
example of the run script for record create:
var proto = new GlideRecord('u_protocol');
proto.initialize();
proto.state = "-5";
proto.u_subject = current.variables.u_subject;
proto.u_requested_for = current.variables.u_item_requested_for;
proto.u_requested_by = current.variables.u_requestor;
proto.parent = current.sys_id;
proto.u_approver = current.variables.u_receiver;
proto.u_business_area = current.variables.u_business_area;
proto.u_type = current.variables.u_type;
proto.u_doc_date = current.variables.u_doc_date;
proto.description = current.variables.ita_comments;
proto.u_project_code = current.variables.u_project_code;
proto.u_sender = current.variables.u_sender;
proto.work_notes = "Approval requested";
proto.approval = "requested";
proto.variables = current.variables;
var sysID = proto.insert();
GlideSysAttachment.copy('sc_req_item', current.sys_id.toString(), 'u_protocol', sysID);
current.short_description = current.short_description+ ' '+ proto.u_business_area + '_'+ proto.u_type + '_'+ proto.u_doc_date + '_' + proto.number;
Approvals etc
Then another run script to change the state on the custom table and add a worknote, then finally a set value to mark as approved and state as completed.
example run script:
var gr = new GlideRecord('u_protocol');
gr.get('parent',current.sys_id);
gr.approval = "approved";
gr.work_notes = "Approved";
gr.state = "3";
gr.update();
Then I also have a workflow running on the custom table that triggers from the creation of the record in a given state that is used to process stuff on that custom table.
Easy enough just be careful of your states and stages, you may wish some processing done at ritm so you may want to include sc_tasks and do some logic but this is how i created custom table record from item
Regards

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2019 11:29 PM