locked
Custom field - Next/Last Appointment? RRS feed

  • Question

  • I am looking for a solution that I have not seen referenced yet on these forums, but if this is repeating another thread, please point me in the right direction.

    I am looking for a way to update two Date fields on my Account form. I want to pull the most recent appointment regarding the account and the next appointment regarding the account and make those visible on the main form. 

    I want this to be an automatic process running in the background, but I haven't been able to do so with workflows to this point. 

    Has anyone had a similar need/solution?


    Dan Garland

    Thursday, December 4, 2014 8:50 PM

Answers

  • A custom workflow uses .Net code using CRM SDK to conditionally fetch data.Once you register the custom workflow activity you will be able to call it in the daily workflow.

    refer http://msdn.microsoft.com/en-us/library/gg328515.aspx


    If my response helps you in finding your answer then please click 'Mark as Answer' and 'Vote as Helpful'

    Tuesday, December 9, 2014 5:56 PM

All replies

  • Dan,

    It is important to know the purpose of these fields.

    1. If these are required to help the user view/plan the interaction while on Account record, then I would use a Javascript to query and populate these fields.
    2. If you need this in a dashboard or a report then use SQL query to fetch the fields than store on the record.
    3. If you need them to be on the views and do not have a lot of Accounts then use a custom application or a custom workflow that updates all records daily. This can hit performance depending on the number of records and execution frequency

    HTH!


    If my response helps you in finding your answer then please click 'Mark as Answer' and 'Vote as Helpful'

    • Proposed as answer by Mamatha Swamy Friday, December 5, 2014 1:06 AM
    Friday, December 5, 2014 1:06 AM
  • Hi,

    I have made something like this.
    You can create a workflow that takes the date from a new appointment and paste it in the Account on the field "Next appointment".
    When closing the appointment, the worklow has to copy the end date in "Most recent appointment".

    This can be done without programming, just by using workflows.

    Friday, December 5, 2014 8:46 AM
  • The purpose would be to have a way to track when the last time we met with an account, and if we have a followup meeting scheduled.

    Ideally this would be viewable at the organization level through an "advanced find" view by filtering for active Accounts and the Last/Next Appointment field with some kind of date range. 

    To address performance, is there a way to make a process like this run daily at a certain time (eg. 2am) then have the field update throughout the day ONLY if an appointment is created/completed/closed?

    once again, sorry for my lack of experience - i'm happy to read on my own and find out how to do this stuff, I just haven't found something quite like this particular application yet.

    Thanks in advance for any help!


    Dan Garland

    Friday, December 5, 2014 6:01 PM
  • This would partially get me there, but it may not work well with the passage of time.

    For example:

    On monday I schedule an appointment for Wednesday with Account ABC. The workflow adds the next appointment to Account ABC's field and all is well until Wednesday.

    On Thursday however, my "next appointment" field still reads the previous wednesday, and will do so until I schedule a new meeting.

    Second example:

    I schedule meeting #1 a couple months away with a client and everything looks good, but then I schedule another appointment (meeting #2) AFTER that appointment but still before meeting #1 has happened - the field would reflect meeting #2 instead of #1 even though it is at a later date.


    Dan Garland

    Friday, December 5, 2014 6:07 PM
  • For the second example, you can compare the dates in the workflow. So if date1 > date 2, it has to copy date 2 in the "next appointment" field. For the first example, I think there is no solution.. You have to create appointments first so the date can be visible on the account form.. Hope this can help you? Regards, Alexander
    Friday, December 5, 2014 6:38 PM
  • Dan,

    You could have a workflow or a console app scheduled to run daily. Here is how you can configure a daily workflow http://www.powerobjects.com/blog/2012/11/09/create-recursive-or-scheduled-workflows-in-crm/. You will need a custom workflow to check the exact next/last appointments for an account and update.

    To update it through the day you will have to add plugins on appointment's Create, Update, Delete, SetState and SetStateDynamicEntity messages to update the account's fields.

    Hope this helps!


    If my response helps you in finding your answer then please click 'Mark as Answer' and 'Vote as Helpful'

    • Proposed as answer by Mamatha Swamy Friday, December 5, 2014 7:21 PM
    Friday, December 5, 2014 7:21 PM
  • "You will need a custom workflow to check the exact next/last appointments for an account and update." - this is the part I am having difficulty with. I can make a workflow run daily, but I cannot seem to reference a "most recent" appointment - If I enter a check condition, I can only reference a set date in time when comparing the times associated with the appointment.

    For example, I can say:
    Appointement -> End Time -> Before -> 12/9/14

    but I cannot say:
    Appointement -> End Time -> Before -> *current system date*

    is there any way to use this type of dynamic value? if not with a workflow maybe with script?

    Dan Garland

    Tuesday, December 9, 2014 5:09 PM
  • A custom workflow uses .Net code using CRM SDK to conditionally fetch data.Once you register the custom workflow activity you will be able to call it in the daily workflow.

    refer http://msdn.microsoft.com/en-us/library/gg328515.aspx


    If my response helps you in finding your answer then please click 'Mark as Answer' and 'Vote as Helpful'

    Tuesday, December 9, 2014 5:56 PM
  • Thanks for your response, but this is a little over my head - Is there a way to do this strictly using the CRM software? (without creating custom code in Visual Studio?)



    Dan Garland

    Tuesday, December 23, 2014 11:12 PM
  • To get the logic you need, I suspect you will need a custom workflow activity or plug-in that runs on the creation of an appointment.  You'll need the help of a developer.

    Regards, Donna

    Thursday, January 8, 2015 4:40 PM
  • That is what I was afraid of Donna. Thanks for your input, I will see what I can do to get our partner to help with this. 

    Dan Garland

    Thursday, January 8, 2015 4:54 PM