- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2024 03:53 AM
Hello
I have a requirement, In change request based on Assignment group their a two Assigned to fields. The user present in first Assigned to field should not be available while selecting the second assigned to field & vice versa.
For Eg: If Assigned to is David Loo then while selecting Assigned too David Loo should not appear when we select on search icon for Assigned too
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2024 06:42 AM
To fulfil your requirement, you need to add an advanced reference qualifier on the 'Assigned Too' field where you can develop logic as follows:
Fetch or pass the value of the 'Assigned To' field first using the reference qualifier.
Use GlideRecord on the user table to retrieve that user's record.
Restrict that user from appearing in the lookup list when you click on the 'Assigned To' field.
Call your script include and function name in the advanced condition of the reference qualifier for the 'Assigned Too' field.
This will definitely helps you to resolved your issue. Let me know in case you need to understand the flow or you can DM on LinkedIn.
If this solution resolves your query, kindly mark it as the accepted solution and give it a thumbs up.
Best Regards,
Krushna Birla
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2024 04:24 AM - edited ‎04-15-2024 04:32 AM
Hi @Krutika Valanj2,
An easy way to resolve this would be to implement an onChange script as below on the 2nd Assigned to field ('Assigned too') . This will ensure the value in field 1 cannot be selected in field 2.
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var assignedTo = g_form.getValue('assigned_to_field name'); //Update the field name here. Assume this is the out of box 'assigned_to' field
if(assignedTo == newValue)
{
g_form.hideFieldMsg('u_assigned_too_field_name'); //Update the field name appropriately
g_form.clearValue('u_assigned_too_field_name'); //Update the field name appropriately
g_form.showFieldMsg('u_assigned_too_field_name', 'Assigned too cannot be the same as Assigned to', 'error');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2024 04:49 AM
Hello @Robbie
I want to remove/hide the user selected in Assigned to field as per your code it is just showing a error msg
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2024 05:48 AM
Hi @Krutika Valanj2,
The g_form.clearValue() method should be removing the value.
Have you ensured you have the correct field name within the method as the example below:
g_form.clearValue('the_field_name_to be_cleared'); //I assume this is 'u_assigned_too' however update appropriately for your field name. Also make sure the field name is within single quotes as show.
If this is not working (I'm not sure why not), but try setting the value to empty as below, however the clearValue method should work.
g_form.setValue('the_field_name_to be_cleared', '');
To help others (or for me to help you more directly), please mark this response correct by clicking on Accept as Solution and/or Kudos.
Thanks, Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-15-2024 06:42 AM
To fulfil your requirement, you need to add an advanced reference qualifier on the 'Assigned Too' field where you can develop logic as follows:
Fetch or pass the value of the 'Assigned To' field first using the reference qualifier.
Use GlideRecord on the user table to retrieve that user's record.
Restrict that user from appearing in the lookup list when you click on the 'Assigned To' field.
Call your script include and function name in the advanced condition of the reference qualifier for the 'Assigned Too' field.
This will definitely helps you to resolved your issue. Let me know in case you need to understand the flow or you can DM on LinkedIn.
If this solution resolves your query, kindly mark it as the accepted solution and give it a thumbs up.
Best Regards,
Krushna Birla