How do I get to the Approval - Group's actual group value from a sysapproval_approver record?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2015 11:04 PM
I want to find the approval group for a sysapproval_approver record that was created from a Approval - Group WF Activity. Though I can get from the approval to the wf_activity, I'm not seeing how to get to the actual values that were filled in on the WF activity form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2015 11:49 AM
I figured out that the wf_activity_variable table references the Approval - Group activity definition, but I still can't figure out how to grab the value of the variable. I can see that the default value of this variable is
// Grab the Approval record
var gr = new GlideRecord('sysapproval_approver');
gr.setLimit(1);
gr.addQuery('sysapproval.number', 'RITM0023610');
gr.query();
while(gr.next()) {
// Grab the Activity Variable record that
// references the Approval - Group activity definition
var gr2 = new GlideRecord('wf_activity_variable');
gr2.addQuery('model', gr.wf_activity.activity_definition);
gr2.query();
while (gr2.next()) {
// Show Keys in the wf_activity_variable
gs.log('***********************************************');
for (var k in gr2) {
gs.log(k + ':' + gr2[k]);
}
gs.log('***********************************************');
}
}
I see properties for a wait_for element and I can see a name property of var__m_... property. So now I feel that I must be very close. I have confirmed that the var__m_ table exists, but, unfortunately, I cannot query that table.
I don't know much about these var__m_... tables, but I can see that the normal table level entry (that doesn't have a column name) doesn't seem to exist on these tables.
When I try this:
var g = new GlideRecord('var__m_354e911f0a0a029a00e6a0e6ad74206f');
g.setLimit(1);
g.query();
while(g.next()){
gs.log(g.wait_for);
}
This causes an error:
JoinQuery invalid field name: .end_split
JoinQuery invalid field name: .split
FAILED TRYING TO EXECUTE ON CONNECTION 14: SELECT 354e911f0a0a029a00e6a0e6ad7420.`approval_script`, 354e911f0a0a029a00e6a0e6ad7420.`relative_duration`, 354e911f0a0a029a00e6a0e6ad7420.`condition`, 354e911f0a0a029a00e6a0e6ad7420.`user_specified_schedule`, 354e911f0a0a029a00e6a0e6ad7420.`.end_split`, 354e911f0a0a029a00e6a0e6ad7420.`timezone_type`, 354e911f0a0a029a00e6a0e6ad7420.`script`, 354e911f0a0a029a00e6a0e6ad7420.`timezone_field`, 354e911f0a0a029a00e6a0e6ad7420.`schedule_field`, 354e911f0a0a029a00e6a0e6ad7420.`field`, 354e911f0a0a029a00e6a0e6ad7420.`reject_handling`, 354e911f0a0a029a00e6a0e6ad7420.`duration`, 354e911f0a0a029a00e6a0e6ad7420.`advanced`, 354e911f0a0a029a00e6a0e6ad7420.`wait_for`, 354e911f0a0a029a00e6a0e6ad7420.`schedule_type`, 354e911f0a0a029a00e6a0e6ad7420.`timer_type`, 354e911f0a0a029a00e6a0e6ad7420.`approver_script`, 354e911f0a0a029a00e6a0e6ad7420.`user_specified_timezone`, 354e911f0a0a029a00e6a0e6ad7420.`.split`, 354e911f0a0a029a00e6a0e6ad7420.`groups` FROM 354e911f0a0a029a00e6a0e6ad7420 354e911f0a0a029a00e6a0e6ad7420 limit 0,1
General Data Exception detected by database (Data truncation: Illegal double '354e911' value found during parsing)
So the wait_for value is still eluding me!
To sum up: There is a wait_for variable for this particular "Approval - Group" wf_activity, but I do not understand how to retrieve the value.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2015 01:26 PM
Just realized that my original question was answered. Closing this as answered and opening the new question. Thanks, Nikita.