locked
How to Default View Service Calendar RRS feed

  • Question

  •  

    Does anyone know how to set the default view of the team calendar to "User" instead of all. I want users to only see their business unit appointments and not the entire organization.  I tried an unsupported method by including javascript in the file to change the selected index, but that wont work 100% cause it requires both frames to be loaded before it can change the index, else the page will post without some important post parameters.

    Friday, February 15, 2008 6:07 PM

Answers

  • Hi.

     

    The crmTypeSelector line does not change the view so you will need to use this js code under the appHeader tag in order to make this work.

     

    The JS line crmTypeSelector.value = "systemuser";

    Is the same as
    <%
           crmTypeSelector.Selected = "systemuser";
    %>

     

    So choose one and delete the other.

     

    Code Snippet

     

    <script>
    window.attachEvent( "onload" , OnAppiontmentBookLoad );
    function OnAppiontmentBookLoad()

    {

        crmTypeSelector.value = "systemuser";
        crmTypeSelector.FireOnChange();

    }
    </script>

     

     

     

    Cheers,

    Adi

    Saturday, February 16, 2008 11:58 AM
  • The solution has to be done client-side (due to the interaction of the frames). The way I do it is to use the ideas behind this post to host the service calendar in a separate page that contains the calendar page, and uses the onreadystatechanged event to manage the timing issues. One advantage of this approach is that it avoids directly modifying any MS supplied files

    Monday, February 18, 2008 11:33 PM
    Moderator

All replies

  • Hi.

     

    What do you mean?

    Do you want the type to be: User and the View to be Local Business Unit?

     

    Adi

     

    Friday, February 15, 2008 8:38 PM
  •  

    Sorry, should have been more specific.

     

    I want the Type to be "All", and the View to be "MyActivites".

     

    Friday, February 15, 2008 9:27 PM
  • Hi.

     

    In the Service Calendar the available types are:

    Appointment and Service activity

    Service Activity

    Appointment

    User

    Resource

    Facility / Equipment

     

    You don't have a type witch is "All"

     

    Are we talking about the same thing?

     

    Adi

     

    Friday, February 15, 2008 10:49 PM
  •  

    GRRRR... I don't know where in the world I got that. You are absolutely correct. I want the first page load to be on User.

    Saturday, February 16, 2008 12:59 AM
  • Hi.

     

    The Service Calendar default Type is resource, so in order to change that you have 2 options

    1. Add client side js to handle the new selected option / value witch is systemuser.

    OR

    2. Add server side code to do just that but with a single line of code :-)

     

    <%
     crmTypeSelector.Selected = "systemuser";
    %>

     

    put this line inside the [Crm Install Dir] \ CRMWeb \ SM \ home_appbook.aspx at the top of the page before the

    Html tag.

     

    Now setting the view is the easy part since you can do that from the CRM customization.

    Select the user entity --> form and views --> select the view you wish to mark as default --> go to more actions and set as default view.

     

    That's it, y'r done.

     

    Cheers,

    Adi

     

     

     

    Saturday, February 16, 2008 1:24 AM
  • Hi.

     

    The crmTypeSelector line does not change the view so you will need to use this js code under the appHeader tag in order to make this work.

     

    The JS line crmTypeSelector.value = "systemuser";

    Is the same as
    <%
           crmTypeSelector.Selected = "systemuser";
    %>

     

    So choose one and delete the other.

     

    Code Snippet

     

    <script>
    window.attachEvent( "onload" , OnAppiontmentBookLoad );
    function OnAppiontmentBookLoad()

    {

        crmTypeSelector.value = "systemuser";
        crmTypeSelector.FireOnChange();

    }
    </script>

     

     

     

    Cheers,

    Adi

    Saturday, February 16, 2008 11:58 AM
  • I currently have client side code to change the selected Index and fire the onchange event. The problem is... is that, if the OnChange event fires too quickly before the two frames have a chance to render, then it throws a javascript error, becuase the OnChange event fires code that relies on elements from both frames. So you get an Object not found exception.

    So... I have been looking for a server-side solution. Your two posts kind of confused me. The first leaves the impression to use one or the other. And then the post following, left the impression that I need both. And I didn't understand why you were saying that I needed to defualt the view on forms and views. If you don't mind, can you finalize your solution? I'll have to give it a shot tuesday morning. Thanks for your help. It is very much appreciated.
    Monday, February 18, 2008 10:48 PM
  • The solution has to be done client-side (due to the interaction of the frames). The way I do it is to use the ideas behind this post to host the service calendar in a separate page that contains the calendar page, and uses the onreadystatechanged event to manage the timing issues. One advantage of this approach is that it avoids directly modifying any MS supplied files

    Monday, February 18, 2008 11:33 PM
    Moderator
  • Hmmm... I'm not seeing how one could use the XmlHttp object with a separate page implementing the calendar. Are you able to provide a working solution?
    Tuesday, February 19, 2008 1:24 AM
  • Hi.

     

    David means that you should change the sitemap URL for the calendar to point to a custom page that hosts an iframe.

    Then you can bind to the onreadystatechange of the iframe and run the js above.

     

    Adi

     

    Tuesday, February 19, 2008 1:30 AM