locked
limiting the number of records for a custom entity RRS feed

  • Question

  • Hi,

    I have 2 custom entities called List and ItemA. List is logically a collection of ItemA. I created a 1 : N relation b/w the two and would like to limit the number of ItemA for a List Entity, such that when the number of ItemA for the List reach its max (say 1,000) we restirct creating new ItemA for the List. 

    I can monitor the number of ItemA in an attribute called counter for List entity and using worflow that tracks creation of ItemA and incrementing the counter in corresponding List entity. 

    How can I restirct the CRM user from creating more records using 'New' when the counter has reached the max int value?    
    Saturday, January 16, 2010 12:24 AM

Answers

All replies

  • Workflow won't be able to do the job, if only because it's asynchronous. I'm thinking jscript will do the job.

    Leon Tribe

    Want to hear me talk about all things CRM? Check out my blog

    http://leontribe.blogspot.com/

    or hear me tweet @leontribe
    Want to hear me talk about all things CRM? Check out my blog http://leontribe.blogspot.com/ or hear me tweet @leontribe
    • Proposed as answer by Leon TribeMVP Saturday, January 16, 2010 2:09 AM
    Saturday, January 16, 2010 2:08 AM
  • Hi,


    You can Try two option for that

    1. You can use js to check the counter and cancel the save event (http://msdn.microsoft.com/en-us/library/cc150868.aspx)
    2. You can also write plugin on precreate to check the counter and display error msg in case of counter has its max value.

    Hope it will help you !!!

     


    Mahain
    Saturday, January 16, 2010 7:39 AM
    Moderator