create a approval record using a script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2017 02:02 AM
Hi,
I need assistance creating an approval record using a script. Can you someone please assist me with the script
var approval_gr = new GlideRecord('sysapproval_approver');
approval_gr.initialize();
approval_gr.state = 'Cancelled';
approval_gr.approver = '';
approval_gr.source_table = '';
approval_gr.document_id = '';
approval_gr.insert();
Thanks,
Adam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2017 02:10 AM
Hi Adam,
What is scope of your requirement? You can try this code to insert an entry into approvals table
var approval_gr = new GlideRecord('sysapproval_approver');
approval_gr.initialize();
approval_gr.state = 'requested';
approval_gr.approver = gs.getUserID(); //Replace with approver from current record
approval_gr.sysapproval = current.sys_id; //Current is record that requires approval
approval_gr.insert();
Thanks
Please Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2017 02:11 AM
The approver and sysapproval columns should be replaced according to your required values.
Thanks
Please Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2017 02:13 AM
Hi adam,
var ar = new GlideRecord('sysapproval_group');
var.initialize();
var.assignment_group = g_sys_id;
var.approval = 'requested';
var.parent = task_sys_id;
var.short_description = current.short_description;
var.description = 'Test Approval Description';
var.insert();
HOpe this helps you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2017 07:35 AM
Thanks for your reply,
im doing it on the sysapproval_approver table so i changed the glide record, but it doesnt insert a new approval record