Business rule for clearing a value is not working

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2018 06:54 AM
I created a catalog item that has a variable called New Information Needed (this variable is a type = Yes/No). That variable is a Yes/No variable type and is REQUIRED. That variable is only visible on Task # 2 in my workflow which has a Rollback activity. So when the wf starts, Task 1 generates. I close complete the task, then Task # 2 generate and the New Information Needed variable is required. When you answer "yes" to that question and then mark the task Closed Complete - the rollback activity kicks in - which will cause Task # 2 to change from a state of Closed Complete to a State = Pending.
What I am looking to do is when that state changes to pending I want to clear the value of "Yes" in that task to "blank". I don't want any value in that field.
Here is my business rule which does not seem to be working:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2018 05:04 AM
Hey Dylan,
Guess what - I don't think we are going to be using the Rollback To feature because I received an email this morning that the Rollback To feature is not provided from Kingston and beyond; therefore, I don't think I want to incorporate this. And in my testing efforts I removed the rollback to feature from the workflow and just connected the "if" statement back to Task # 1. It did the same thing the only difference was it put the state in Open vs Pending. I still need to clear the value though, so I am going to see if I can do this via a catalog client script.
If you have any thoughts or suggestions around getting the value cleared I would appreciate it.
Thanks again.
Karen

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2018 05:58 AM
Good morning Dylan,
Could you assist with the script? This is what I have but I keep getting an error
answer = ifScript();
function ifScript() {
if (current.variables.mct_new_info == "Yes")
g_form.clearValue('mct_new_info','');
return 'yes';
else
return 'no';
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2018 06:14 AM
Good morning! I'm always happy to help.
So instead of checking for/returning yes or no, you want to return true or false. Your script will look something like this:
answer = ifScript();
function ifScript() {
if(current.variables.mct_new_info) {
g_form.clearValue('mct_new_info','');
return true;
} else {
return false;
}
}
Also with your if statement, if you have more than one line of code in one block you have to wrap it in curly braces.
P.S. If this doesn't work, try putting true or false in quotes.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2018 06:20 AM
Good day Dylan,
I wanted to say thank you for all of your assistance. I managed to get it work via a Client Script. But the most important thing that I learned in this process and the reason it wasn't working before is because of the rollback the "System" was automatically changing the state from Closed Complete to Pending or Open; however, when I really thought this process out I had to realize that once Task #2 was reopening with a state of Open/Pending I then realized that the customer was not physically changing the state. Hence onChange of State. So when I tweeked the script to say onChange of state from Open to Work in Progress and as the customer I physically changed the state from Open to Work in Progess it worked like a charm.
I just wanted to share that with you.
Your conversation / assistance is much appreciated.
Karen

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2018 06:24 AM
That's great Karen! I'm glad I could helped, and thanks for sharing I learned something from this post too 🙂
Cheers,
Dylan