locked
Retrieving values from an entity RRS feed

  • Question

  • Hi,

    I am having many appointment records. Just more that 10 records.

    Is it possible to loop through all records and find the last appointment date and the next appointment date in crm4.0???

    any suggestion???

     

    Wednesday, June 30, 2010 5:24 AM

Answers

  • Hi !

    You can use a fetchXML query to find the last appointment :

    This one will give you the last appoitment (based on schedulestart attribute) :

    <fetch count='1' mapping='logical'>
    	<entity name='appointment'>
    		<all-attributes/>
    		<order attribute='scheduledstart' descending='true'/>
    	</entity>
    </fetch>

    You can use the Fetch method of the CrmService, either through javascript (using an xmlhttprequest) or through server side code (using the CrmService class from the sdk).

    For more info, please check those msdn links :

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

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

    Hope this helps !

    EuG

     

    Monday, July 5, 2010 9:24 AM

All replies

  • Hi !

    You can use a fetchXML query to find the last appointment :

    This one will give you the last appoitment (based on schedulestart attribute) :

    <fetch count='1' mapping='logical'>
    	<entity name='appointment'>
    		<all-attributes/>
    		<order attribute='scheduledstart' descending='true'/>
    	</entity>
    </fetch>

    You can use the Fetch method of the CrmService, either through javascript (using an xmlhttprequest) or through server side code (using the CrmService class from the sdk).

    For more info, please check those msdn links :

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

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

    Hope this helps !

    EuG

     

    Monday, July 5, 2010 9:24 AM
  • You could use a workflow to store these values against the parent record.

    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, July 17, 2010 4:53 PM
    Saturday, July 17, 2010 4:53 PM
  • Hi,

    You can build Query Expressions / Fetch XML Criteria.

    Sort the "scheduledstart" column by DESC order.

    if more than on record returns, you can set the First record [from the list] as NEXT Appointment and the second record as the LAST appointment.

    EX: you got 10 records:

    Rec # 1. NEXT Appointment

    Rec # 2. LAST Appointment

    3........ 10th

    Hope this will help.


    Thanks, Ranjitsingh R | http://mscrm-developer.blogspot.com/ | MS CRM Consultant
    Monday, July 19, 2010 8:59 AM