locked
need help with fetch query and updating RRS feed

  • Question

  • I have field item called "orders", when the number in the field is updated, a fetch query executes telling the user how many orders have been placed for the client. The new number is not reflected in the fetch query. For instance, if there are 10 orders, and the user adds a new order, there should now be 11. What happens is that 10 orders are show. 

    The problem seems to be that the form saves the new order, and retrieve the order at the same time so it thinks there is 10. If you save the form twice the new value of 11 shows.

    is there a trick to make this work?

    Friday, November 22, 2013 12:12 PM

All replies

  • Hi,

    Do you run your plugin on pre or post operation? If you make a query on pre operation, your new record will not exist yet when the query is executed.

    Regards,

    Adam

    Friday, November 22, 2013 12:56 PM
  • I have the plugin and in the same situation in and I am using Post but I have decided to remove the plugin because it is messing with other values and there is too much that can go wrong with the plugin. Right now I am using client-side javascript and using the onSave event. I am looking for a workaround if you know of one.

    edit: messy typing.

    • Edited by Abraham182 Friday, November 22, 2013 1:00 PM
    Friday, November 22, 2013 12:58 PM
  • Well, you can check the form state, and add plus one to the amount in case the javascript is fired on a create form.
    Friday, November 22, 2013 1:01 PM
  • You could add a javascript timeout and call the javascript inside fields's update function or wait for the form to complete load before triggering fetch query.

    Tuesday, November 26, 2013 1:11 AM