Error message when editing a SharePoint document and resubmitting toa database

S

sboyd

I have a form that submits to a database connection and then to
SharePoint, which takes the primary key with it. If I click on the
document to open it, it will not allow me to make changes because it
gives the error

InfoPath cannot submit the form.An error occurred while the form was
being submitted.
Row cannot be located for updating. Some values may have been changed
since it was last read.



I can move the submit to SharePoint first and then to the database and
the id doesn't go to SharePoint and I can resubmit without errors;
however when you edit the document and resubmit to the database, a new
line is added to the database instead of updating the original line
because the primary id is not in the form.

I found some information about setting a rule on the submit, to check
the id but I can't figure out how and where I should place the rule.
Obviously I need the primary key go with the form to SharePoint. I
was actually trying to get the SharePoint name to be the added date
and the id field so that when the form was updated the name didn't
change. I've tried several different ways to do this but I
continuously get the message above.

Does anyone know how I can resolve this problem? I'm supposed to have
a good update on this project tomorrow so any help today would be
greatly appreciated.

Thanks

siboyd
 
G

Gavin McKay

Hello,

You may need to use code-behind to either get the ID prior to the form being
displayed, or set the id based on information you retrieve from the database.

For example, you could create a web service that returns the ID given
parameters you provide, and then set the ID in your xml. The web service
could be a secondary data source that you manually submit using the object
model in your code-behind. So the steps could be:

1. on Infopath form load submit secondary data source
2. Get results of data source
3. Save primary ID results to "myFields" primary data source

HTH

Gavin.
 
S

sboyd

Hello,

You may need to use code-behind to either get the ID prior to the form being
displayed, or set the id based on information you retrieve from the database.

For example, you could create a web service that returns the ID given
parameters you provide, and then set the ID in your xml.  The web service
could be a secondary data source that you manually submit using the object
model in your code-behind.  So the steps could be:

1. on Infopath form load submit secondary data source
2. Get results of data source
3. Save primary ID results to "myFields" primary data source

HTH

Gavin.









- Show quoted text -

I don't know how to do code behind. I've managed to get things
accomplished without writing any code. I think I have this problem
resolved. I had a rule that SharePoint didn't like so I deleted it
and came up with something else that worked. I'm not getting any
errors but I've noticed something else. I have several fields that
have defaults set. If I change a value from the default, the correct
values submit to the database but they revert back to the defaults
before it goes to SharePoint. So how can I get the document to submit
to SharePoint just as it went to the database? Unchecking the boxs to
recalculate when values change prevents it from doing what it's
supposed to the rest of the time. The fields are prepopulated with
default values but these values can be changed. They work just fine
until after it's submitted. Does anyone know how I might fix this?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top