- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2017 08:41 AM
Hi All,
Hopefully someone can help with the following. it sounds simple enough, but I can't get what I want to do to work.
What I need to happen is for a variable on a request task form to become mandatory on or before the 'Close Task' action. I have explored this via UI Policy and got it to work for it to be mandatory. However, the issue I have with that method is the task will need some work completing before variable information is acquired and you cannot save it as the field has already become mandatory.
The method I am now exploring is the onSubmit client script, but I am open to other options...
function onSubmit() {
var action = g_form.getActionName();
if (action != 'close_sc_task')
return;
var state = '3'; // Closed Complete State
if (action == 'close_sc_task');
g_form.setMandatory('business_email', true); // business email is the variable that need to become mandatory
}
What I have seen with the above script is that the business email variable flashes briefly with the mandatory asterisk, but the task closes anyway. Any help would be appreciated.
Many Thanks...
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2017 01:09 PM
I think I used the wrong syntax for the business rule. After Helsinki, they changed the syntax and no longer use onBefore() onAfter() methods. See if you can use this in your Set g_scratchpad for sc_task business rule:
(function executeRule(current, previous /*null when async*/) {
g_scratchpad.wf_activity = current.wf_activity.getDisplayValue();
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2017 01:22 AM
I'm afraid not, I can't seem to get anything from all the help that been given on my post to work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-13-2017 01:28 AM
can you share your entire on submit script. And to confirm once you are going to achieve this on task page right. It worked in my page .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-24-2020 11:02 AM
Hey Vasmi. I tried your script and it worked with one exception. If I click close task and there is an existing field that is required and prompts me for input then once I input that field and click close task again - it bypasses the script and let's it go through. Any ideas?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2018 07:46 AM
This thread is Awesome....Thanks for the post..Helped me alot...
