locked
reoccuring appointments MS CRM 4.0 RRS feed

  • Question

  • Can someone tell me if there is a way to link reoccuring appointments from outlook to MSCRM 4.0 as well as setup reoccuring appointments in MSCRM 4.0

    Saturday, January 17, 2009 3:55 AM

Answers

  • Hi,

     

    The functionality of recurring activities is not present in Dynamics CRM 4.0. You can't create recurring appointments using out-of-the-box functionality. Additionally, if you synchronize your recurring appointment from Outlook, you will lose the recurrency. However, there are some workarounds to create a recurring appointment - you can use workflow to create a new appointment, once you close the existing one or once e.g. the date has passed. It's a little bit cumbersome, but it seems to be the way...

     

    I hope that helps.

    Regards,

    Kuba

    Saturday, January 17, 2009 2:09 PM

All replies

  • Hi,

     

    The functionality of recurring activities is not present in Dynamics CRM 4.0. You can't create recurring appointments using out-of-the-box functionality. Additionally, if you synchronize your recurring appointment from Outlook, you will lose the recurrency. However, there are some workarounds to create a recurring appointment - you can use workflow to create a new appointment, once you close the existing one or once e.g. the date has passed. It's a little bit cumbersome, but it seems to be the way...

     

    I hope that helps.

    Regards,

    Kuba

    Saturday, January 17, 2009 2:09 PM
  •  

    So what you’re saying is, Microsoft created customer relation management software that does not have the ability to create and track a reoccurring appointment with ease, (brilliant). I hope this is corrected in a patch, upgrade, or a SP soon.

    Thanks for the help

     

    Leon Cordero

     

    Network Administrator / HL7 Interface Specialist
    Saturday, January 17, 2009 11:24 PM
  • It is possible to create reoccuring appointments in MS CRM 4.0 without using workflow.

    I have done one implementation for creating reoccuring service activity. I have added two new fields in the Service Activity entity.
    Please read the detailed implementation below:

    Entity Name: serviceappointment

    Add two new Fields

    New Field 1
    -----------
    Field Label: Recurring Frequency
    Field Name: new_recurringactivity
    Requirement Level: No Constraint
    Field TYpe: picklist
    Field Values:

    1 - Daily
    2 - Weekly
    3 - Fortnightly
    4 - Monthly
    5 - Bi-Monthly
    6 - Quarterly
    7 - Half Yearly
    8 - Yearly

    New Field 2
    -----------
    Field Label: Recurring End Date
    Field Name: new_recurringenddate
    Field Type: datetime
    Field Format: Date Only
    Requirement Level: No Constraint

    Purpose of the new fields
    -------------------------
    Field Name: new_recurringactivity
    Purpose: This field will accept recurring frequency from the user.

    Field Name: new_recurringenddate
    Purpose: This field will accept the date from the user. It will not create any activity beyond the date. Otherwise it will go in a endless loop.

    CODE SNIPPET 1
    --------------
    // Add this code snippet to the OnLoad event of the Service Activity Form

    // Lock the recurring Service Activiy fields once activities have been created
    if (crmForm.all.new_recurringactivity.DataValue)
    {
    crmForm.all.new_recurringactivity.disabled = true;
    crmForm.all.new_recurringenddate.disabled = true;
    }

    ----------------------------------------------------------------------------------
    CODE SNIPPET 2
    --------------
    // Add this code snippet to the OnSave event of the Service Activity

    // Function to format a date to the UTC format required by web services
    function DateToUTCFormat(inputDate)
    {
    var date = inputDate.getDate();
    var month = inputDate.getMonth()+1;
    var year = inputDate.getYear();
    var hours = inputDate.getHours();
    var minutes = inputDate.getMinutes();
    var ampm = " AM";
    if (hours > 11)
        {
        ampm = " PM";
        hours = hours - 12;
        }
    if (hours == 0)
        {hours = 12;}
    if (minutes < 10)
        {var time = hours.toString() + ":0" + minutes.toString() + ":00" + ampm;}
    else
        {var time = hours.toString() + ":" + minutes.toString() + ":00" + ampm;}
    var UTCDate = month.toString() + "/" + date.toString() + "/" + year.toString() + " " + time;
    return UTCDate;
    }


    if (crmForm.all.new_recurringactivity.disabled == false && crmForm.all.new_recurringactivity.DataValue && crmForm.all.new_recurringactivity.DataValue)

    {
    var interval = 0;
    switch (parseInt(crmForm.all.new_recurringactivity.DataValue))
    {
    case 1:   // Daily (Please check the value you are getting from the CRM Form)
     interval = 1;
     break;

    case 2: // weekly
     interval = 7;
     break;

    case 3: // Fortnightly
     interval = 14;
     break;

    case 4: // Monthly
     interval = 30;
     break;

    case 5: // Bi-Monthly
     interval = 60;
     break;

    case 6: // Quarterly
     interval = 90;
     break;

    case 7: // Half Yearly
     interval = 180;
     break;

    case 8: // Yearly
     interval = 365;
     break;

    }

    var recurringEnd = crmForm.all.new_recurringenddate.DataValue;
    recurringEnd.setDate(recurringEnd.getDate()+1);
    var activityStart = crmForm.all.scheduledstart.DataValue;
    var activityEnd = crmForm.all.scheduledend.DataValue;

    // Set the first reccuring appointment as per the recurring frequency opted by the user

    activityStart.setDate(activityStart.getDate()+interval);
    activityEnd.setDate(activityEnd.getDate()+interval);

    // Prepare values for the new Service Activity

    var subject = crmForm.all.subject.DataValue;
    var regardingId = crmForm.all.regardingobjectid.DataValue[0].id;
    var customerId = crmForm.all.customers.DataValue[0].id;
    var serviceid = crmForm.all.serviceid.DataValue[0].id;
    var resourceId = crmForm.all.resources.DataValue[0].id;
    var ownerId = crmForm.all.ownerid.DataValue[0].id;
    var new_recurringactivity = crmForm.all.new_recurringactivity.DataValue;

    // Loop for the number of recurring Service Activities
    while (activityStart < recurringEnd)
        {   
        // Prepare the SOAP message.
        var startUTC = DateToUTCFormat(activityStart);
        var endUTC = DateToUTCFormat(activityEnd);
       // alert("startUTC: "+startUTC);
        var recurringEndUTC = DateToUTCFormat(recurringEnd);
        var authenticationHeader = GenerateAuthenticationHeader();
        var xml = "<?xml version='1.0' encoding='utf-8'?>" +
        "<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'"+
        " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'"+
        " xmlns:xsd='http://www.w3.org/2001/XMLSchema'>"+
        authenticationHeader+
        "<soap:Body>"+
        "<Create xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>"+
        "<entity xsi:type='serviceappointment'>"+
        "<subject>"+subject+"</subject>"+
        "<serviceid>"+serviceid+"</serviceid>"+
        "<ownerid>"+ownerId+"</ownerid>"+
        "<customers>"+
            "<activityparty>"+
                "<partyobjecttypecode>account</partyobjecttypecode>"+
                "<partyid>"+customerId+"</partyid>"+
                "<participationtypemask>11</participationtypemask>"+
            "</activityparty>"+
        "</customers>"+
        "<resources>"+
            "<activityparty>"+
                "<partyobjecttypecode>systemuser</partyobjecttypecode>"+
                "<partyid>"+resourceId+"</partyid>"+
                "<participationtypemask>1</participationtypemask>"+
            "</activityparty>"+
        "</resources>"+
        "<scheduledstart>"+startUTC+"</scheduledstart>"+
        "<scheduledend>"+endUTC+"</scheduledend>"+
        "<new_recurringenddate>"+recurringEndUTC+"</new_recurringenddate>"+
        "<new_recurringactivity>"+new_recurringactivity+"</new_recurringactivity>"+
        "</entity>"+
        "</Create>"+
        "</soap:Body>"+
        "</soap:Envelope>";
        // Prepare the xmlHttpObject and send the request.
        var xHReq = new ActiveXObject("Msxml2.XMLHTTP");
        xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
        xHReq.setRequestHeader("SOAPAction","http://schemas.microsoft.com/crm/2007/WebServices/Create");
        xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
        xHReq.setRequestHeader("Content-Length", xml.length);
        xHReq.send(xml);
        // Capture the result
        var resultXml = xHReq.responseXML;

        // Check for errors.
        var errorCount = resultXml.selectNodes('//error').length;
        if (errorCount != 0)
            {
             var msg = resultXml.selectSingleNode('//description').nodeTypedValue;
             alert(msg);
            }
        // Notify user of Service Activity creation
        else
            {
           // alert("Service Activity created on " + activityStart);
            }
        // Increment the next Service Actvity to be created by as per the recurring frequency opted by the user
        activityStart.setDate(activityStart.getDate()+interval);
        activityEnd.setDate(activityEnd.getDate()+interval);
        }
     
    } // Code block Ends

    Some More Explanation
    ---------------------
    Please note in the above code snippet I am taking resources as user. So for that I have used in the code snippet

    "<resources>"+
            "<activityparty>"+
                "<partyobjecttypecode>systemuser</partyobjecttypecode>"+
                "<partyid>"+resourceId+"</partyid>"+
                "<participationtypemask>1</participationtypemask>"+
            "</activityparty>"+
        "</resources>"+

    If you are considering equipments as your resources then use

       "<partyobjecttypecode>systemuser</partyobjecttypecode>"+


    Also note that if you want to accept multiple resources then you need to change the value in the "participationtypemask" node.

    Since I am expecting 1 resource so I have kept the value as 1.

    Let me know if this helps.

    Regards,

    Sarbashish Bhattacharjee

    Sunday, September 5, 2010 11:17 AM
  • Is this code for a recurring service activity or recurring appointment?

    Appears in this other post its for recurring service activity yes in this post its referenced as a recurring appointment.

    http://sarbashish.wordpress.com/2010/09/09/how-to-create-recurring-service-activities-in-ms-crm-4-0/

     

    Thursday, September 23, 2010 4:29 PM
  • Sorry, the error i am getting is:

    There was an error with this field's customized event.

    Field:crmForm
    Event:onsave
    Error:'crmForm.all.regardingobjectid.DataValue.0' is null or not an object.

    I have added this under appointment and i get this error.

    Thursday, September 23, 2010 4:34 PM
  • Hello Leon

    It's true that we can not create reoccuring appointments in CRM 4.0. But in CRM 2011, a new activity has been added for reoccuring appointments.

    Saturday, September 25, 2010 8:59 AM
  • Sorry, the error i am getting is:

    There was an error with this field's customized event.

    Field:crmForm
    Event:onsave
    Error:'crmForm.all.regardingobjectid.DataValue.0' is null or not an object.

    I have added this under appointment and i get this error.


    Please tell me some SOMEONE has figured this error out. I can't figure out a way around it and it's starting to drive me insane.
    Tuesday, October 19, 2010 2:02 PM
  • Sarbashish, Do you have any idea what's causing this error and how to fix it?

     

    Field:crmForm
    Event:onsave
    Error:'crmForm.all.regardingobjectid.DataValue.0' is null or not an object.

     

    I appreciate any help you can give.

    Tuesday, October 19, 2010 2:04 PM
  • Shinzon,

    You may not be aware of this, necessarily, but I fully expect Sarbashish to: never reference an array item unless you're certain it exists.  With Lookup fields, their DataValue member is an array.  A script should always validate that DataValue is not null before referencing any elements therein.  The error is coming from the fact that your record does not have a value in the "Regarding" field.  So, there are two fixes:

    1. Put a value in the "Regarding" field, and make sure there is always a value in it when the script runs; or, ideally
    2. Write the script to include checks for whether or not values exist in this field (and other Lookups)
    That said, there are some short-comings of his code: namely the proper handling of the duplication of "Customers" and "Resources" fields when those fields contain more than one record.  I hope he will fix the code for you, with these considerations in mind.  If, however, he does not, please post again to this thread:  I'll be keeping a watchful eye over it.  I hate to correct somebody's code without their express invitation for me to do so--but in the interest of resolving the scripting error (if you have no experience with CRM scripting), I would not mind issuing some corrections to finalize this matter.
    Dave Berry - MVP Dynamics CRM - http:\\crmentropy.blogspot.com
    Tuesday, October 19, 2010 5:42 PM
    Moderator
  • Dear Shinzon,
    Sorry for responding late. The code I have posted was for service appointment and similarly it can be done for appointments as well. The form elements are slightly different so there needs some tweak in the code. Tomorrow I will write the code for appointment form and give you the exact code snippet.



    Sarbashish Bhattacharjee
    Thursday, October 21, 2010 11:00 PM
  • Hi Kuba,

    Please could you tell me the steps when you create these workflows?

    I have created one that starts when the service activity is created and when the new attribute changes. The attribute i added was just a pick list for the customer to decide if the appoinment is recurring or not. So the first step was to have a check condition on that attribute if "yes" then create a new activity 7 days after start date of the original with the same details. and the new appoinments will keep the "yes" in the recurring attribute, so it will keep creating the activity every week.

    But it doesnt work the way i want. It keeps making a new appoinment 7 days later after the original, but the date does not change from there, its always only 7 days form the original date...

    Kind regards,

    Meg

    Tuesday, November 9, 2010 9:27 AM

  • Hi Guys,

     

    I have managed to create a recurring service activity using workflows in Microsoft Dynamics CRM4.0.

    You can go through it on the following link.

    http://jawadarif.wordpress.com/2010/11/11/ms-dynamics-crm-4-recursive-service-activity/

     

    Let me know if it would have served the purpose.

     

    Regards,

    Jawad

    Wednesday, November 17, 2010 3:59 AM