- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2014 04:14 AM
In our early days we had a consultant do a few bits of work for us before he left.
One was a Time Mandatory IU policy which has just been rewritten to be more effective.
and this has led to a problem with a UI Action on a change Task
The problem is that under the ui policies, the time worked looked at the assignment group and often had a default value of 0 which satisfies the mandatory requirement
The new method looks as the current user and sees if they have a TimeMandatory role and then makes the field mandatory and clears the value.
We need to have the indicator to show the field is mandatory
The UI Action is called "Go to Change" which is non "client" and has the following script
var gr = new GlideRecord('change_request'); gr.addQuery('number', current.change_request.number); gr.query(); gr.next() ; action.setRedirectURL(gr);
the problem is, if I go into a change Task and do nothing other than click on the "Go to Change" button, I am asked to enter some time
i cannot understand why as the code above is not saving the current record so there is no need to add any time.(I suspect the action.setRedirectURL is the cause)
I cannot make the field non mandatory unless I change the UI action to be client and then use a g_form.setMandatory, and then it does not want to redirect
Any ideas or suggestions on
- How to amend the above script so it marks Time Worked as non mandatory before redirecting
- change the script to user callable and be able to redirect
- An alternative way to deciding if "Time worked" needs to be mandatory.
I have wondered about a check to see if specific fields have been modified and then mark the field as mandatory, but UI policies are no really doing it for me as they do not seem to detect changes. Client scripts would need one per field (pity there is not an OnChange - field name *), Business rules don't quite seem to fit.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2014 04:29 AM
Hi Julian,
You can combine client and server side code in UI Action. Please refer below for your reference:
UI Action:
Action Name : ui_action_test
Client : true
Onclick : combTest()
Script:
function combTest(){
//write client side code for example, g_form.setMandatory("fieldName",false);
gsftSubmit(null, g_form.getFormElement(), 'ui_action_test'');
}
if (typeof window == 'undefined')
callServercombTest();
function callServercombTest(){
//write server side code for example, action.setRedirectURL(gr);
}
Let me know if you have any queries.
Please mark answer as correct/helpful, if it was really helpful
Regards,
Solutioner
Enhance Knowledge NOW@ www.solutioningnow.com
http://www.solutioningnow.com/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2014 04:29 AM
Hi Julian,
You can combine client and server side code in UI Action. Please refer below for your reference:
UI Action:
Action Name : ui_action_test
Client : true
Onclick : combTest()
Script:
function combTest(){
//write client side code for example, g_form.setMandatory("fieldName",false);
gsftSubmit(null, g_form.getFormElement(), 'ui_action_test'');
}
if (typeof window == 'undefined')
callServercombTest();
function callServercombTest(){
//write server side code for example, action.setRedirectURL(gr);
}
Let me know if you have any queries.
Please mark answer as correct/helpful, if it was really helpful
Regards,
Solutioner
Enhance Knowledge NOW@ www.solutioningnow.com
http://www.solutioningnow.com/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-03-2014 06:11 AM
Excellent, that works a treat