Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.
Pop-up prompt to select Field

Beantwortet Pop-up prompt to select Field

  • Mittwoch, 16. Mai 2012 14:05
     
     

    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.

Alle Antworten

  • Mittwoch, 16. Mai 2012 14:15
    Moderator
     
     Beantwortet

    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.

  • Mittwoch, 16. Mai 2012 14:18
     
     Beantwortet Enthält Code

    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!

    • Als Antwort markiert JMcCon Mittwoch, 16. Mai 2012 14:56
    •  
  • Mittwoch, 16. Mai 2012 14:56
     
     

    Thanks for the replies guys.

    Both of these worked.