Webservice is called twice, should be one time? - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Webservice is called twice, should be one time?

Last post 02-08-2011 06:17 AM by showet. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 11-08-2010 06:14 AM

    Webservice is called twice, should be one time?

    I have a relatively complex InfoPath 2007 form without code that is misbehaving and I don't know why.

    The form has one field that is used to create a unique name and a unique key in SharePoint and an Oracle database.  The field is populated using a rule under Form Options/Open and Save.  The rule simply says if the field is blank, call a webservice that creates the unique number and populate the field.

    What the web service does is to grab the "next" (unused) number from a database and add a prefix to it, for example it gets 851 and adds CO2010 so the field is populated with "CO2010851". The same web method adds a new record in the database with this number so a record exists for this number and cannot be used by another form being opened.

    After the field on the form is populated with the number the rest of the form acts normally.  When the form is finally submitted, the fields are copied to SharePoint and to the database through another web method.

    The problem is, when a new form is opened for the first time, somehow the webservice is ALWAYS called twice because it creates two records in the database with sequestion unique numbers, this is before the form is submitted, just when the form is opened for the first time.  I know the webservice is actually called twice because that is the only way the prefix for the number could be added and the number itself incremented.  What I can't figure out is why the webservice is called twice.

    Thanks for any help you can give.

  • 11-08-2010 08:22 AM In reply to

    Re: Webservice is called twice, should be one time?

    Hi, do you have some rules on "open behavior" from form options ?

  • 11-08-2010 08:40 AM In reply to

    Re: Webservice is called twice, should be one time?

    The only rule is :

    Condition = if the field is blank

    Actions:

    Set a field value: (send User ID, required by web method)

    Query using a data connection: (call my web method)

    Set a fields value: (populate the field with the value returned from the web method)

     

    Everthing appears to work exactly as intended, it just does it twice so every other record in the database is empty except for the sequential number.

     

  • 11-09-2010 06:56 AM In reply to

    Re: Webservice is called twice, should be one time?

    Anyone have any ideas on this?  We need to move to production VERY soon and I really don't want to add two records (one sequential but empty) to the database for every case we add.

  • 11-09-2010 08:18 AM In reply to

    Re: Webservice is called twice, should be one time?

    Hi --

    Is your data connection for your web service set to run on load? That is, it runs when the form opens AND in the open rule?

    Hilary Stoupa

  • 02-08-2011 06:17 AM In reply to

    Re: Webservice is called twice, should be one time?

    Thank you, Thank You, Thank You.  That should have been obvious but I missed it.  I had almost given up on resolving this so I really appreciate your following up on this old request.

Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.