- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2017 09:18 AM
Is there a way to set a default value by using a UI Policy? I am making some changes to our change_request form. We have 3 types of Change Requests:
- Normal
- Standard
- Emergency
If Emergency is selected, I need the Out Of Band value to be automatically be defaulted to yes or true. If it is a Standard or Maintenance, I need to Out Of Band field to still show but not default to Yes\True or No\False. I know I can set a default value on the dictionary entry but that would default Out of Band for all 3 categories which isn't what I need to happen. Thanks for any feedback!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2017 09:50 AM
Hi,
Write an On Change Client script with the Field Name selected as Change Type field having values "Emergency, Normal etc. Below code should work for your requirement:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(newValue=='Emergency')
{
g_form.setValue('Field Name',true);
}
else if(newValue == 'Normal')
{
g_form.setValue('Field Name',true);
}
}
Note: Replace the field Name in the script above with the exact Field Name you want to set the value for.
Hope this help. Mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2017 09:43 AM
Hi Jonathan,
Yep, this is easily achieved within a UI policy by leveraging the scripting functionality.
Navigate to the UI policy and ensure you're in the 'Advanced View'. (Available via a link at the bottom left hand side of the screen if not in advanced view)
Firstly, on the 'When to Apply' tab, make sure you set the conditions to Type is Standard (As below)
Then, select the 'Script' Tab. Ensure the 'Run Scripts' checkbox is set to true and you can set values based on the Change 'Type' field.
In the below example I'm entering the string 'Testing' in the justification field for Change Requests of type Standard.
Please mark correct and/or helpful on your post link (Setting Default Values ) to help close out open questions and aid others with the same/similar question.
Thanks,
Robbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2017 09:50 AM
Hi,
Write an On Change Client script with the Field Name selected as Change Type field having values "Emergency, Normal etc. Below code should work for your requirement:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(newValue=='Emergency')
{
g_form.setValue('Field Name',true);
}
else if(newValue == 'Normal')
{
g_form.setValue('Field Name',true);
}
}
Note: Replace the field Name in the script above with the exact Field Name you want to set the value for.
Hope this help. Mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2017 10:24 AM
Thank you everyone!! Problem solved!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2017 10:40 AM
Hi Jonathan,
Can you please mark the answer as correct so that the thread can be closed.
Regards,
Shloke
Regards,
Shloke