locked
Most Recent List RRS feed

  • Question

  • Anyone seen an add-on or sample code that shows how to list a "Most Recent" list for an entity (account, opportunity, etc)?

    I see one on the iotap site but no reply back from them. Saleforce.com has this feature.

     

    Thanks

    Friday, May 7, 2010 5:12 PM

Answers

  • hmmm, there is no built  in function  for  this.  but here is a trick you can do. please  note, there may exits other way for the same thing

    1) create a date time attribte  on your entity e.g. openedDate

    2) once  the entity is open, in the onLoad() event, call the CRMWebservice and update the openedDate with current date. i.e.

    function onLoad(){

    openedDate = new DateTime();

    save the date using the CRMWebservice javascript

    3) Now you can create a system view on the openedDate or  use it in your QueryExpression for LastXDays.

     


    Muhammad Ali Khan
    My MS CRM blog
    Friday, May 7, 2010 6:26 PM

All replies

  • Hi  michael

    In  order  to  get the most recent  list for an entity, use the QueryExpression,  and  in  the ConditionExpression,  specify your  conditon.  see below for example return the account in last X(10) days

    QueryExpression query = new QueryExpression();
    query.EntityName = EntityName.account.ToString();

    // Retrieve the accounts where the last name is not Cannon.
    ConditionExpression condition = new ConditionExpression();
    condition.AttributeName = "createdon";
    condition.Operator = ConditionOperator.LastXDays;
    condition.Values = new object[1];

    condition.Values[0] = 10;

    // Build the filter based on the condition.
    FilterExpression filter = new FilterExpression();
    filter.FilterOperator = LogicalOperator.And;
    filter.Conditions = new ConditionExpression[] {condition};

    // Set the Criteria property.
    query.Criteria = filter; 

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


    Muhammad Ali Khan
    My MS CRM blog
    Friday, May 7, 2010 5:58 PM
  • I forgot to add it's the Most Recent that I last touched. In salesforce I can open 5 different opportunities, just view, no edits.

     

    When I close salesforce and come back it has those 5 listed in Most Recent list.

     

    Friday, May 7, 2010 6:19 PM
  • hmmm, there is no built  in function  for  this.  but here is a trick you can do. please  note, there may exits other way for the same thing

    1) create a date time attribte  on your entity e.g. openedDate

    2) once  the entity is open, in the onLoad() event, call the CRMWebservice and update the openedDate with current date. i.e.

    function onLoad(){

    openedDate = new DateTime();

    save the date using the CRMWebservice javascript

    3) Now you can create a system view on the openedDate or  use it in your QueryExpression for LastXDays.

     


    Muhammad Ali Khan
    My MS CRM blog
    Friday, May 7, 2010 6:26 PM