New forms inheriting the wrong data - InfoPath Dev
in

InfoPath Dev

New forms inheriting the wrong data

Last post 05-22-2007 12:27 AM by YoungSC. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 05-15-2007 06:05 PM

    • YoungSC
    • Not Ranked
    • Joined on 02-28-2007
    • Australia
    • Posts 13

    New forms inheriting the wrong data

    I've published a form to a forms library.  The forms library has a number of fields I created (SP_WorkflowID, SP_SaveAsDraft) whose default value is set to 0 from the Form Library settings.  The form itself has the same named fields (WorkflowID, SaveAsDraft) which are populated from the forms library field values as part of the form load rules.  These fields are used to show where the form is in the workflow, whether the form is a draft etc. 

    For example, I have created a button on the form called 'Save As Draft'.  When clicked, it changes the value of the SaveAsDraft field on the form to 1.  All data validation on the form references this field and disables data validation as a result.  The next function for the button rules is to submit the form to the SharePoint library.

    Once submitted, you can look at the form library in SharePoint and see something similar to the following.

    Name               Modified By          SP_WorkflowID       SP_SaveAsDraft       WorkflowID       SaveAsDraft

    Form Name      Simon                  0                            0                              0                     1

    My problem is, that once a form sits in the top row of the form library documents with the SaveAsDraft field set to 1, whenever I open a new form from the form library, the form inherits the SaveAsDraft value of 1.  This causes all my data validation to be turned off for the new form :(.  I don't want this to happen, I wan't every new form to open with the default value of 0 for all these fields.

    Can anyone tell me why SharePoint does this and how I can solve my problem?

    Thanks,

    Simon

  • 05-15-2007 11:25 PM In reply to

    • YoungSC
    • Not Ranked
    • Joined on 02-28-2007
    • Australia
    • Posts 13

    Re: New forms inheriting the wrong data

    Further investigation reveals that if I select the 'Include data for the active form only' check box in the data connection wizard, I don't get the inheritance problem. 

    Wizard Screenshot 

     

     

     

     

     

     

     

     

     

     

     

     

    The new problem is, I can't seem to get access to the values in the SP_WorkflowID, SP_SaveAsDraft etc fields, therefore, I can't run my rules on the form that leverage off these values.  I am using a data connection to this SharePoint library and I have put these fields from the SharePoint library on the form so I can check their values for testing purposes.  When I open the form, these fields are blank where I would expect to see a numerical value.

    Can anyone offer any suggestions as to why this is the case?

    Thanks,

    Simon

     

     

  • 05-17-2007 12:01 AM In reply to

    Re: New forms inheriting the wrong data

    Hey Simon,

    So you have a Data Connection which receives data from the SharePoint Library.  One thing is make sure you have either the query when form is loaded checked or you are querying the data connection before you try to access a field value from it. 

    Second, if you have multiple forms in the form library the query will load all of them and give you the first value unless you use a filter to get the data from a specific form title or whatever. So if you want the value from form X, you must specify the field value with a filter title=X.xml. 

    As I am thinking of it, why do you need to query a promoted field anyway? Why do you not get the value from the field in the form which was promoted to SharePoint? They should be the same. So instead of the SP_SaveAsDraft, just ues SaveAsDraft from your form?  Maybe I am not understanding exactly what you need but that is my input.

  • 05-17-2007 05:47 PM In reply to

    • YoungSC
    • Not Ranked
    • Joined on 02-28-2007
    • Australia
    • Posts 13

    Re: New forms inheriting the wrong data

    Hi Clay,

    Thanks for the answer.

    My main reason for using the SharePoint fields is because I need the workflow to change the values so the form can use these values for it's logic (views, data validation, conditional formatting).  My understanding is that promoted fields from the form are read-only in SharePoint and can't be changed.  Please tell me I'm wrong on this point and I'll be a happy man :)

    Another assumption I have made is that by selcting the check box 'Include data for the active form only' would only send me data for the form I am using.  Again any correction here is welcomed.

    Thanks,

    Simon

  • 05-17-2007 08:13 PM In reply to

    Re: New forms inheriting the wrong data

    Yes the promoted properties cannot be changed in SharePoint they just display what is in the form.

    Now does the Workflow ID and other fields get assigned in the form? Or do you want them to be modified by some external process? You are pretty much stuck editing these fields within the form.

    OK, I just had one idea, have not tried it, but I will write it out and see if it makes sense.  I am thinking it would be possible to create a seperate SharePoint list, which could be modified and then just have one of the fields contain the link to the corresponding form in your form library.  To create the link should not be hard since the path is constant and you are creating the name the form is saved under. You can use a CAML and update the SharePoint list as the form is submitted, a tutorial is in a blog here.  This might give you the functionality you are looking for and the user would have a hyperlink that would behave the same as selecting the form in the form library. You could filter the list if you wanted and also use it as a secondary data connection to update the form when it was opened to the new values that were possibly set in SharePoint.

    So form is created and submitted. Submit saves it into the form library, the SP list is inserted with a new row that contains the fields you want and a hyperlink to the form.

    Someone in SharePoint updates the list values. Then they or someone else uses the hyperlink and opens the form.  As the form opens it checks the values of the SP List and updates its values to match. The user sees the form with the values set in SharePoint.  I believe this is what you are looking for.

    Typically any values that pertain to the form are changed in the form and SharePoint just allows you to see some key fields before you open one.  But I believe in this scenario, although somewhat complex, could allow for fields in SharePoint to be used in your forms and modified externally, at least from the users perspective.

    Not sure if this what you need but I am trying to be creative. :)

  • 05-22-2007 12:27 AM In reply to

    • YoungSC
    • Not Ranked
    • Joined on 02-28-2007
    • Australia
    • Posts 13

    Re: New forms inheriting the wrong data

    Hi Clay, Again thanks for your suggestions. I have tried a couple of them without success and the others are beyond my skills. Fortunately we are able to get some consultant time, so hopefully they can suggest a suitable approach.
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.