How to create UI action button to Auto populate Assignment group on a custom form?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 01:35 PM
Hi all,
I have a requirement when a UI action called 'Review' is clicked:
1- The state field is changed to "Review" & Assignment group is to auto populate by 'Review group'
We have a challenge figuring out how to auto populating the assignment group. Does anyone knows how to solve this problem?
Thought about BR, but I'm reach out if there is better solution.
function moveToReview() {
g_form.setValue("state", "9");
gsftSubmit(null, g_form.getFormElement(), "new_state_move_to_review");
}
if (typeof window == 'undefined')
setRedirect();
function setRedirect() {
current.update();
action.setRedirectURL(current);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2023 05:20 PM
Hi @Salah2
I think best practice is to implement UI Policy to auto-populate the Assignment Group when the "Review" UI action is clicked.
UI Policies allow you to dynamically set field values, visibility, and mandatory attributes based on certain conditions.
You can also try below code -
function moveToReview() {
// Set the state to "Review".
g_form.setValue("state", "9");
// Get the assignment group field.
var assignmentGroupField = g_form.getField("assignment_group");
// Set the value of the assignment group field to "Review group".
assignmentGroupField.setValue("Review group");
// Submit the form.
gsftSubmit(null, g_form.getFormElement(), "new_state_move_to_review");
}
Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!
Regards,
Tushar