Workflow activity field on the sysapproval_approver table

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2009 07:10 AM
There is a reference field on the sysapproval_approval table called Workflow activity that references the wf_activity table. On our instances, this is always blank, even when the approval has been generated from a workflow activity. I would like to get the workflow activity populated into this field when the approval is generated from a workflow. Anyone have any ideas? I was thinking maybe i would have to change the Activity definition for the user approval, but I can't figure out what exactly to add there.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2009 02:15 PM
I would take a look at the activity definitions in the demo instance and make sure yours match up with what is there. This is definitely something that should be working for you. Here's the section of code from the activity definition for user approvals that you'll want to look at.
_createNewApproval: function(userId, state, approvalOrder) {
var approval = new GlideRecord('sysapproval_approver');
approval.initialize();
approval.sysapproval = current.sys_id;
approval.approver = userId;
approval.wf_activity = activity.activity.sys_id;
approval.state = state;
if (approvalOrder)
approval.order = approvalOrder;
approval.expected_start.setValue(this.expected_start);
approval.due_date.setValue(this.due_date);
return approval.insert();
},

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2009 03:34 PM
I did find that in the activity definition. It turns out the column names weren't matching up, so it's working now.
Thanks for the help!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2009 02:07 PM
I have used the information in this topic to dynamically assign an approver to a requested item. After the item has been approved, the task is not being created.
I understand that I need to further modify the script, but I am not sure what else will be required. I borrowed and did a bit of modifying to code i have found in other topics to come up with this. I was hoping someone could help me finish this off.
function getApprover() {
var _approverList = new Array();
_approverList.push(current.requested_for.manager.user_name);
return (_approverList);
}
function createNewApproval(userId, sysID) {
var _approval = new GlideRecord('sysapproval_approver');
_approval.initialize();
_approval.sysapproval = sysID;
_approval.approver = userId;
_approval.state = 'requested';
_approval.wf_activity = activity.activity.sys_id;
var _sysid = _approval.insert();
gs.eventQueue("request.approval.inserted",_approval,'','');
return _sysid;
}
var _approverList = getApprover();
var _gr = new GlideRecord("sc_req_item");
_gr.addQuery("request", current.sys_id);
_gr.query();
while (_gr.next()) {
/* create new approval */
var _sysID = createNewApproval(_approverList[0].toString(), _gr.sys_id);
/* set approval for item */
var _approval = new GlideRecord('sysapproval_approver');
_approval.addQuery("sys_id", _sysID);
_approval.query();
_gr.sysapproval = _approval;
_gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2010 11:28 PM
Hi rad,
However I have different issue, i have created a workflow on user created table (by me) & I am not able to see "Approval User/group" in the left hand side activity tree. any idea why it is not coming n how to get this field ?
thanks,
AA