- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2014 02:02 AM
Hi SNC,
I am trying to set up a use case where when a user tries to close a catalog task, he has to enter customer comment notes.
For the action of closing the catalog task I have an UI Action button on the catalog task form, which has the following code:
current.task_state = 3;
current.update();
For the user comments field I am using the customer comments field from the RITM.
And for the script I wrote, it's on the catalog task table, and it looks like this:
So at first sight it all seems OK, but if I change the state from the drop down list. However, when I try to click the UI button, it does not work. It just closes the task without prompting me for anything.
Any ideas where am I going wrong?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2014 02:11 AM
Add this code to your ui action
if(g_form.getValue('comments') == ''){
//Remove any existing field message, set comments mandatory, and show a new field message
try{g_form.hideFieldMsg('comments');}catch(e){}
g_form.setMandatory('comments', true);
g_form.showFieldMsg('comments','Comments are mandatory','error');
return false; //Abort submission
}
Use the ui action that has both client anbd server side code. this will be client side code, and
current.task_state = 3;
current.update();
this will be your server side code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2014 02:07 AM
UI action button will directly update record and wont give chance to your onChange script to alert/make field mandatory.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2014 02:10 AM
If this is the case you could set this mandatory in the ui action script rather than the on change script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2014 02:13 AM
I am looking for the alternative.
But even at the end of UI action if you write current.update(); this wont be checking for mandatory fields are filled or not!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2014 02:08 AM
I think you need to use 'producer.comments' instead of 'request_item.comments' or it might be 'producer.request_item.comments' I'm not sure with out access to your form.
Whenever you use GSC variables you need to prefix producer to the field you are trying to use.