Display Problem_id field state on incident form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2022 02:28 AM
Hello ALL,
on incident form there is problem_id field there.i want to populate state of problem_id on incident form.for populate value I wrote one script in UI Action.
function checkStateOfProblem() {
var data = g_form.getReference('problem_id', doAlert);
function doAlert(data) {
if (data.getValue('state') == 102 || 1 || 2 || -5) {
alert('you cannot cancel incident ticket because state is ' + data.getValue('state'));
alert((data.state).getDisplayValue());
alert(g_form.getDisplayValue('state'));
} else {
alert('you can cancel' + data.getValue('state'));
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2022 04:55 AM
@Sagar_pawar what is the question here? If you want the display value of state use:
alert(data.state.getDisplayValue());
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2022 06:16 AM
Hi @Sagar_pawar,
As Raghav mentioend, you have to use the displayValue instead of getValue.
alert("add message here " + data.getDisplayValue("state"));
Thanks,
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2022 06:32 AM
Hello, @Sagar Pagar and @RaghavSh I tried both scripts as you mentioned but it's not working for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2022 07:10 AM
@Sagar_pawar if both are not working then go via server script instead of client side code in ui action:
current.problem_id.state.getDisplayValue();
Or
current.problem_id.getDisplayValue('state');
This code should be outside function, means the UI action should not be client true.
Raghav
MVP 2023