Answered by:
Pop-up prompt to select Field

Question
-
I have a field called Type.
I want a pop-up window to appear on Save of the form if a value has not been selected for the Type field.
I want the pop-up to bring the user back to the form until the user selects a value for the Type field.
Anyone know how to do this?
Thanks.
Wednesday, May 16, 2012 2:05 PM
Answers
-
Why don't you just make that field required, then CRM won't allow user to save record without that.
Mahain : Check My Blog
Follow me on Twitter
Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.- Proposed as answer by Gonzalo Ruiz RModerator Wednesday, May 16, 2012 2:23 PM
- Marked as answer by JMcCon Wednesday, May 16, 2012 2:56 PM
Wednesday, May 16, 2012 2:15 PMModerator -
You can put some code in the onsave event on a form.
check some values, if a certain value isn't selected then you can cancel the save event.
The blog below shows how it can be done for the case entity
http://crmbusiness.wordpress.com/2012/03/14/crm-2011-adding-validation-to-the-resolve-case-button/
// Use the following function on Form Save Event, // CRM will pass the execution context in function parameter prmContext function FrmOnSave(prmContext) { // Local variable to store value indicating how the save event was initiated by the user. var wod_SaveMode, wod_SaveEventVal; // Change the Save Event Value as per required Save Event wod_SaveEventVal = <Value>; if (prmContext != null && prmContext.getEventArgs() != null) { wod_SaveMode = prmContext.getEventArgs().getSaveMode(); // 1 will pass on Recalculate button click if (wod_SaveMode == wod_SaveEventVal) { // Write your validation code here alert("Write your validation code here"); // Use the code line below only if validation is failed then abort function save event prmContext.getEventArgs().preventDefault(); } } }
Ben Hosking
Check out my CRM Blog
Linked-In Profile
Follow Me on Twitter!- Marked as answer by JMcCon Wednesday, May 16, 2012 2:56 PM
Wednesday, May 16, 2012 2:18 PM
All replies
-
Why don't you just make that field required, then CRM won't allow user to save record without that.
Mahain : Check My Blog
Follow me on Twitter
Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.- Proposed as answer by Gonzalo Ruiz RModerator Wednesday, May 16, 2012 2:23 PM
- Marked as answer by JMcCon Wednesday, May 16, 2012 2:56 PM
Wednesday, May 16, 2012 2:15 PMModerator -
You can put some code in the onsave event on a form.
check some values, if a certain value isn't selected then you can cancel the save event.
The blog below shows how it can be done for the case entity
http://crmbusiness.wordpress.com/2012/03/14/crm-2011-adding-validation-to-the-resolve-case-button/
// Use the following function on Form Save Event, // CRM will pass the execution context in function parameter prmContext function FrmOnSave(prmContext) { // Local variable to store value indicating how the save event was initiated by the user. var wod_SaveMode, wod_SaveEventVal; // Change the Save Event Value as per required Save Event wod_SaveEventVal = <Value>; if (prmContext != null && prmContext.getEventArgs() != null) { wod_SaveMode = prmContext.getEventArgs().getSaveMode(); // 1 will pass on Recalculate button click if (wod_SaveMode == wod_SaveEventVal) { // Write your validation code here alert("Write your validation code here"); // Use the code line below only if validation is failed then abort function save event prmContext.getEventArgs().preventDefault(); } } }
Ben Hosking
Check out my CRM Blog
Linked-In Profile
Follow Me on Twitter!- Marked as answer by JMcCon Wednesday, May 16, 2012 2:56 PM
Wednesday, May 16, 2012 2:18 PM -
Thanks for the replies guys.
Both of these worked.
Wednesday, May 16, 2012 2:56 PM