Silverlight DataServiceQuery $expand caching fields

Answered Silverlight DataServiceQuery $expand caching fields

  • Friday, January 18, 2013 9:13 PM
     
     

    I have a DataServiceQuery in Silverlight selecting from ServiceActivity and expanding on Contacts to return contact fields.

    I've noticed that if I'm in my application and viewing an SA it correctly shows the contact field. However, if I go into CRM and change this Contact field, my Silverlight application does not update the Contact field.

    For grins, I added the same field to the SA and did the same test. It correctly changed the field.

    For some reason, the fields from the $expand are not updating after I modify them in CRM unless I close my browser and come back to it. Is there anything I can do in my Silverlight application to make sure it "refreshes" and gets the new value?

    Thanks

All Replies

  • Saturday, January 19, 2013 7:29 AM
    Moderator
     
     

    Are you using silverlight webresourc or you have created a silverlight application which is running out of CRM context, if you have silverlight webresource you could try to refresh it using javascript onchange of contact field and if you are using a silverlight application out of crm context you could write a timer code to check crm data in specific interval if it is changed then reload your data in silverlight UI.


    Contact Me
    Follow me on Twitter
    My Facebook Page
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

  • Tuesday, January 22, 2013 3:10 PM
     
     

    Mahender,

    It is a Silverlight app running out of CRM context.

    The problem is when I query the data when the user does something on the page. It should be pulling the new information from CRM but it does not do it for the Contact entity referenced in my AddQueryOption("$expand"...)

    It only pulls the new information from the ServiceActivity.  If I close the app and go back to it, it will pull the new information but will cache it again if I change the contact info while the user is still within my silverlight application. If they re-run the SA search, it will not update.


    • Edited by Babaganush Tuesday, January 22, 2013 3:10 PM
    •  
  • Wednesday, January 23, 2013 5:21 AM
     
     

    Hello Babaganush,

    Please share your code which will retrieve the data from CRM to your Silverlight Application, Like ServiceActivity code and Contact code as well.

    Cheers


    Warm Regards, Suresh Kumar D

  • Wednesday, January 23, 2013 6:41 AM
    Moderator
     
     

    Try to use  clear cache like below before your retrieve call.

    ClearCache("yourentityname");


    Contact Me
    Follow me on Twitter
    My Facebook Page
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

  • Wednesday, January 23, 2013 7:06 AM
     
     Answered Has Code

    Try this for your SL context.

    context.MergeOption = MergeOption.OverwriteChanges;

    • Marked As Answer by Babaganush Wednesday, January 23, 2013 2:49 PM
    •