- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2024 06:35 AM
Hello all,
Good evening.
I have created a button on Incident form.
UI action name: Escalate
So, the user should be able to click the button only twice.
SO, I have created a field "Escalation count" (u_escalation_count) of type integer on the Incident form.
So, once the user clicks on the button for the first time, the count has to be updated by 1.
When the user clicks the button for the second time, then count has to be updated by 2.
For this I have written a code, but the problem is,
The count is getting updated with 1 for the first time, but the second time, the value is updating with 2 but when I refresh the form, the value is again getting back to 1.
Please help me.
My Code:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2024 12:33 PM - edited 11-12-2024 12:57 PM
The following worked for me.
function doEscalate(){
var ec = g_form.getValue('u_escalate_count');
alert('doEscalate: ec = ' + ec);
if(ec==0){
g_form.setValue('u_escalate_count',1);
}
else if(ec==1){
g_form.setValue('u_escalate_count',2);
}
alert('doEscalate: submitting record, u_escalation_count = ' + g_form.getValue('u_escalation_count'));
g_form.submit();
current.update();
action.setRedirectURL(current);
}
That is, if the default value of your custom field is 0. If null, it doesn't work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2024 12:33 PM - edited 11-12-2024 12:57 PM
The following worked for me.
function doEscalate(){
var ec = g_form.getValue('u_escalate_count');
alert('doEscalate: ec = ' + ec);
if(ec==0){
g_form.setValue('u_escalate_count',1);
}
else if(ec==1){
g_form.setValue('u_escalate_count',2);
}
alert('doEscalate: submitting record, u_escalation_count = ' + g_form.getValue('u_escalation_count'));
g_form.submit();
current.update();
action.setRedirectURL(current);
}
That is, if the default value of your custom field is 0. If null, it doesn't work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-12-2024 09:26 PM
Thank you Bert,
It works
Regards,,
Pallavi