Confirming Actions With an "Are you sure?" Prompt in Infor CRM (Saleslogix)

I’m not a huge fan of bugging end users. I figure, if an end user clicked something, he or she meant to click it. However, that’s not always the case. It’s especially a good idea for destructive actions or for things that will make a lot of changes and you want to make sure before you pass the point of no return. If a user clicks something and you need to confirm the action with some sort of “Are you sure?” prompt, then it must be done. So, I suppose it’s a necessary evil and something that fortunately is very easy to do in Infor CRM (Saleslogix).

Confirming Actions With a Prompt – Are You Sure?

Creating an “Are you sure?” kind of prompt is a pretty easy task. There’s many places where you have that sort of thing built in. Many clickable things like buttons have a built in Confirmation Message property where you can add in your “Are you sure” message and the rest of the magic is added for you. Well, it is the action that that has that Confirmation Message property, not necessarily the button. But, what if you need to do it somewhere else? Or only on certain conditions? It’s easy to add both in the Quick Form designer and in code.

Adding the Confirmation Prompt in the Quick Form Designer

When adding it in the form designer, it’s always best to use the built in one, if that makes sense for what you’re doing. For example, if you have a button that deletes something and you want the button to prompt before deleting, by all means, just enter the “Are you sure?” prompt in the Confirmation Message property of the action. However, if that doesn’t apply to the control you’re using, simply add the following in the OnClickClick property:

return confirm('Are you sure?');

The OnClientClick will run before the actual click event fires and since you’re returning the result of the confirmation it will either stop or continue to the actual click action as a result of the confirm prompt.

Adding the Confirmation Prompt in Code

Adding the confirmation prompt in code is just as easy, with a few more bits. The benefit here (and this is really what I wanted to get to with this post) is that you can conditionally prompt the user based on something else. Let’s say you have a parent Widget with child WidgetItems. You have a “Move Widget” button to move the Widget to another account, but if the Widget has child Items, you want to make sure the user wants to move the Widget *and* the child WidgetItems to the new account. You’d add code to the OnClientClick property in the form’s Load Action like this:

if (widget.WidgetItems.Count > 0)
    buttonMoveWidget.OnClientClick = "return confirm ('This widget has child items. Are you sure you want to move the widget AND the child items?');";

Now, the code for the click action for the buttonMoveWidget just assumes the move is a go and proceeds with things normally. When the user clicks the button, they’ll get the confirmation prompt and if they say “no” the click action that does the move will never fire, but if they say “yes” things go on as normal.

Want content like this delivered to your inbox? Sign up for our newsletter!

Ryan Farley

Ryan Farley is the Director of Development for Customer FX and creator of He's been blogging regularly about SalesLogix, now Infor CRM, since 2001 and believes in sharing with the community. His new passion for CRM is Creatio, formerly bpm'online. He loves C#, Javascript, web development, open source, and Linux. He also loves his hobby as an amateur filmmaker.

Submit a Comment

Your email address will not be published. Required fields are marked *