The CreatorCon Call for Content is officially open! Get started here.

OnChange client script or business rule to not all change form to close if category is other and to remain on the review state with an error message

Lydon
Mega Expert

I have a requirement to not allow change for to close if category is "other" and state is "close"

 

I did a business rule and does not work as expected.

I would like to see the firm stay on review with an error message, "please select correct category besides other" 

I feel like an OnChange client script will work better but not very familiar with client scripts

Can I get help please 

6 REPLIES 6

Tony Chatfield1
Kilo Patron

Hi, unfortunately a partial screenshot of your laptop screen does not provide any details that would allow the forum to assess your script.
An onChange() Client script could be used to prevent options from being available in a choice list if the record is in a specific state, but normally I would also an a before() BR to ensure any update was aborted if the user was somehow able to circumvent the client script (if the client script failed to load, the user made the update from list view etc).

Perhaps you could attach a plain text version of your BR (an xml export is best) and a clear description of the requirement, actual field names etc; so that the forum can better understand what it is you are trying to do as your post is not very clear.

@Tony Chatfield 

 

it does work with the BR but throws an error message invalid input, plus it defaults to closed, only when I refresh the page does it change to review

Please see my BR here 

 

Thank you

find_real_file.png

andfind_real_file.png

 

I understand with abort action selected, it will always show invalid input but my concern is that the form actually closes and I would like for it to remain on review prompting the user to select to change the category to something else besides other

@Tony Chatfield

Please also keep in mind that I am not trying to make any options not available in the choice list, I will like the choice list to remain as it is but prompt the user to change selection if the category is "Other" and they select close to close out the form. As stated earlier, the Business rule works partially, I just wish for it to remain in the review state and the prompt the user to change category. Right now, when I select closed, it seems like it closed and that my expected message pops up with the invalid input then I have to refresh the page to see it on the review state

 

my users will not know to refresh the page

 

Thank you 

Aman Kumar S
Kilo Patron

Hey @Lydon ,

Try using this:

 current.setAbortAction(true);
 action.setRedirectURL(current);
 current.state = previous.state;
 current.update();

 

Feel free to mark correct, If I answered your query.

Will be helpful for future visitors looking for similar questions 🙂

Best Regards
Aman Kumar