locked
Pass Scheduling Engine Results to Form (appointmentproposal) RRS feed

  • Question

  • I have written a plug-in to call the service management scheduling engine and I am able to get back a list of possible times and sites that meet my criteria (appointmentproposals). The plug-in is triggering from the update methothod of a custom entity. How do I pass these back to the form that triggered the update so that I can display and choose them?

     

    Thanks in advance

    Thursday, May 19, 2011 5:02 PM

Answers

  • I wrote mine using the XRM LINQ CrmSvcUtil generated classes in CRM 4.0 embedded in an IFRAME wrapped standalone web application.

    If I was to do it again in CRM 2011, I'd probably use the early-bound classes in a Silverlight app - although performance was not my greatest concern, as I had to pass off my potential results to a SQL Server DB for sorting, prioritising and auto-allocation (course/subject/instructor etc app) and it was of primary importance to get the scheduling correct.

    I'm afraid I don't know at this stage what mechanism will give the most responsive results.  Many people are having issues with the early bound classes and doing nasty things like caching their connection/context to circumvent the startup delays - I suspect (particularly given some vague comments in the SDK) there are better ways to deal with this, but haven't had time to experiment.

    Silverlight vs HTML/jQuery vs Standalone ASPX probably won't make a lot of difference, so go with where your skills and/or Customer requirements direct.

    If, as you already are, you can retrieve your potential results in a plugin, that would almost certainly be the quickest method, as long as you can figure out how to attach those results to your custom entity in a form that is usable by whatever mechanism you choose to go with for display/interaction.

    That said, a single (or even a series of) SearchRequest will probably not see an appreciable difference between any of the methods - the majority of the time will be taken by the CRM scheduling engine.  Even with the work that the CRM has to do, I was seeing some pretty impressive performance despite having to perform multiple Searches, hand off the results, juggle it around, return and display.


    --pogo (pat) @ pogo69.wordpress.com
    • Marked as answer by KevinIA Thursday, May 19, 2011 7:45 PM
    Thursday, May 19, 2011 7:29 PM

All replies

  • There is no simple mechanism to pass a collection of entity instances back to an entity form from a plugin.

    Using built-in CRM methods, you could define a 1:N relationship between your custom entity and a new custom entity (a wrapper around the relevant attributes in the appointmentproposal entity - this is necessary because you cannot define a 1:N relationship with appointmentproposal), then populate that collection using your returned results.

    The collection will then be available (if you've defined the relationship appropriately) in the navigation bar on the left of the form.  There are methods to show these associated views in an IFRAME on the form if you'd prefer they were directly available.

    Whether this is useful depends on what you wish to do with the data once it's returned.  If you are subsequently scheduling, you could allow the user to select an item from the grid and trigger the next step via javascript; whatever mechanism is responsible for the scheduling would then have to extract the relevant data out of your custom entity instance to create the appointment or service appointment.

    Instead of using a plugin to return the results, an alternative to all of this is to host a scheduling mechanism in an IFRAME or (for CRM 2011) web resource.  I've gone the former (IFRAME) for a custom scheduling application that was far too complicated for the built-in CRM scheduling engine.  The advantages of this is that you still have access to the CRM scheduling engine (available appointment times, service definition, resources/groups etc), but have complete control over the booking, flow control etc.


    --pogo (pat) @ pogo69.wordpress.com
    Thursday, May 19, 2011 6:52 PM
  • Pat....

    You got it. Essentialy I am trying to write a replacement for the built-in schedulingdialog.aspx in an on-premise 2011 application. I am trying to call the scheduling engine from a dialog as one continuous process where dialog answers are aggregated and fed to the scheduling engine.

    Performance is key for me and I will have multiple users hitting the engine simultaneously.

    If I go the web resource route, how do you suggest i interact with the SearchRequest API (JScript....plug-in attached to entity...)

    Ever grateful...Kevin

    Thursday, May 19, 2011 7:11 PM
  • I wrote mine using the XRM LINQ CrmSvcUtil generated classes in CRM 4.0 embedded in an IFRAME wrapped standalone web application.

    If I was to do it again in CRM 2011, I'd probably use the early-bound classes in a Silverlight app - although performance was not my greatest concern, as I had to pass off my potential results to a SQL Server DB for sorting, prioritising and auto-allocation (course/subject/instructor etc app) and it was of primary importance to get the scheduling correct.

    I'm afraid I don't know at this stage what mechanism will give the most responsive results.  Many people are having issues with the early bound classes and doing nasty things like caching their connection/context to circumvent the startup delays - I suspect (particularly given some vague comments in the SDK) there are better ways to deal with this, but haven't had time to experiment.

    Silverlight vs HTML/jQuery vs Standalone ASPX probably won't make a lot of difference, so go with where your skills and/or Customer requirements direct.

    If, as you already are, you can retrieve your potential results in a plugin, that would almost certainly be the quickest method, as long as you can figure out how to attach those results to your custom entity in a form that is usable by whatever mechanism you choose to go with for display/interaction.

    That said, a single (or even a series of) SearchRequest will probably not see an appreciable difference between any of the methods - the majority of the time will be taken by the CRM scheduling engine.  Even with the work that the CRM has to do, I was seeing some pretty impressive performance despite having to perform multiple Searches, hand off the results, juggle it around, return and display.


    --pogo (pat) @ pogo69.wordpress.com
    • Marked as answer by KevinIA Thursday, May 19, 2011 7:45 PM
    Thursday, May 19, 2011 7:29 PM
  • Thank you Pat. Your time and expertise is appreciated.

     

    K

    Thursday, May 19, 2011 7:46 PM