- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 11:48 AM
I need to change a field on the task form if the assignment group changes. The field is a variable field called new_assingment_group. I need this field populated with the new assignment group for an upstream task in the workflow, but I cannot seem to get it to work.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var ba_group = g_form.getValue('assignment_group',callMe);
function callMe(ba_group)
g_form.getReference('assignment_group', function(callMe) {
if (callMe) {
g_form.setValue('new_assignment_group',ba_group);
}
});
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2024 01:45 PM
I figured out why my initinal code was not working. The semi colon was missing from this line. g_form.getReference('assignment_group', function(user) {
if (user)
Should have been
g_form.getReference('assignment_group', function(user) {
if (user);
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
// Type appropriate comment here, and begin script below
var ba_group = g_form.getValue('assignment_group');
// Use getReference with callback
g_form.getReference('assignment_group', function(user) {
if (user); {
g_form.setValue('new_assingment_group',ba_group);
}
});
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 12:04 PM
Hi @ronyates,
please check below script:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
// Fetch the new assignment group value
var newAssignmentGroup = g_form.getValue('assignment_group');
// Set the new assignment group value to the variable field
g_form.setValue('new_assignment_group', newAssignmentGroup);
}
Thank you, please make helpful if you accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 12:17 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-11-2024 01:45 PM
I figured out why my initinal code was not working. The semi colon was missing from this line. g_form.getReference('assignment_group', function(user) {
if (user)
Should have been
g_form.getReference('assignment_group', function(user) {
if (user);
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
// Type appropriate comment here, and begin script below
var ba_group = g_form.getValue('assignment_group');
// Use getReference with callback
g_form.getReference('assignment_group', function(user) {
if (user); {
g_form.setValue('new_assingment_group',ba_group);
}
});
}