- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2017 06:27 AM
Hi All
I am trying to write UI Action script for below scenario:
when Demand manager go to an existing demand that is in draft status and do NOT fill in any/all of the below fields and click on"Submit demand" button then there should be an error message that reads "The following mandatory fields are not filled in : <field name1> , <field name2>":
Business Unit
Primary Queue
Value Driver
Proposed Start Year
I have written UI Action as:
Table: IT Demand [tsp1_demand]
Active: True
Show update: True
Onclick: checkRequired()
Client: True
Condition: current.state==1 && gs.hasRole('demand_manager')
Script:
function checkRequired() {
var bunit = g_form.getValue('u_portfolio_bu');
var pqueue = g_form.getValue('u_primary_queue');
var vdriver = g_form.getValue('u_initiative');
var psuser = g_form.getValue('u_start_year');}
if (bunit == '' && pqueue == '' && vdriver == '' && puser == '') {
g_form.setMandatory('u_portfolio_bu', true);
g_form.setMandatory('u_primary_queue', true);
g_form.setMandatory('u_initiative', true);
g_form.setMandatory('u_start_year', true);
g_form.showFieldMsg('u_portfolio_bu','u_primary_queue','u_initiative', 'u_start_year','is required to submit.', 'error');
}
Above script is not working, user is able to Sumbit demand and there is no error message.
This is the first time I am writing script, please help me in correcting this script.
Thanks and Regards
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2017 12:21 PM
why did you close the function block. before the if condition.
function checkRequired() {
var bunit = g_form.getValue('u_portfolio_bu');
var pqueue = g_form.getValue('u_primary_queue');
var vdriver = g_form.getValue('u_initiative');
var psuser = g_form.getValue('u_start_year');
if (bunit == '' && pqueue == '' && vdriver == '' && puser == '') {
g_form.setMandatory('u_portfolio_bu', true);
g_form.setMandatory('u_primary_queue', true);
g_form.setMandatory('u_initiative', true);
g_form.setMandatory('u_start_year', true);
g_form.showFieldMsg('u_portfolio_bu','u_primary_queue','u_initiative', 'u_start_year','is required to submit.', 'error');
}
gsftSubmit(null, g_form.getFormElement(), '<ui Action action name>'); //please mention your ui action "action name"
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-03-2017 12:26 PM
that's why i did not mention the name

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2017 10:16 AM
Hi devr ,
is there any update on this thread? do you need any further help then please let us know.
if your query has resolved please mark the answer correct and close this thread.
How To Mark Answers Correct From Community Inbox