0

I am using SharePoint 2010 , I have a custom list with four columns.This list is modified in infopath form just added a button to it.I have to use a web service as data connection and on entering the prjct_Id in the form and click on button I should get the three values of the text box populated in the form.Please refer to the form in the image.Please help me in the scenario.I don't have depth knowledge in infopath forms. enter image description here

enter image description here enter image description here enter image description here

1

You can do this by following steps

  1. Manage Data Connections -> Add
  2. Select Create a new connection to: -> Receive data -> Next
  3. Select the source of your data = SOAP Web Service -> Next
  4. Web service details. Enter http://serviceurl.asmx?WSDL -> Next
  5. Select your operation -> Next
  6. Using Set Value -> Choose input value to a valid (This is just for setting up the connection) Proj_ID -> Next
  7. Check Automatically retrieve data when form is opened -> Finish

Now Add an Action to your button

  1. Set value for Proj_ID

Next Add another action Query for data

  1. Select new connection created

This will create response fields in the Fields window. You can now set it to your respective text boxes

  • Hi Amal I tried your steps , here I am using rest service instead of soap as you mentioned in steps and I am getting this error."A query to retrieve form data cannot be completed because this action would violate cross-domain restrictions. If this form template is published to a SharePoint document library, cross-domain access for user form templates must be enabled under InfoPath Forms Services in SharePoint Central Administration, and the data connection settings must be stored in a UDC file in a data connection library in the same site collection." – SPLearner May 12 '15 at 21:04
  • I resolved it by adding Data Connection Library, but am still getting a different error " Unable to connect to the remote server An entry has been added to the Windows event log of the server. Log ID:5566 Correlation ID:a744fbab-6e30-4b19-a382-74d6095ce145" – SPLearner May 12 '15 at 21:24
  • Hi Amal I even resolved the second error by enabling cross domian option in central admin under infopath form services. Now when I enter the projectid and click on button i am not getting the values . Please check my query and set value options i have done . Let me know if i did anything wrong . Thanks. – SPLearner May 13 '15 at 14:34
  • Use the value that is present in the connection itself #6 above – Amal Hashim May 13 '15 at 14:38
  • I have updated the image above set value directly as 72267 – SPLearner May 13 '15 at 14:43
1
  1. While using REST webservice we have to follow these steps in InfoPath form
  2. Manage Data Connections -> Add
  3. Select Create a new connection to: -> Receive data -> Next
  4. Select the source of your data = REST Web Service -> Next
  5. Web service details. Enter "http://pesdd:7789/GlobalService.svc/PhaseDataByProjectAndPhaseID?prjct_id=" ->Next
  6. Uncheck the Automatically retrieve data option and click Finish
  7. Click on covert to connection file on right side
  8. A pop up opens asking for udcx path
  9. Create a document data library in your site where you are going to publish the InfoPath form
  10. give the path of the data connection library like "http://pedsssv//libraryname/Forms" and add the name next to forms with udcx as extension like "http://pedsssv//libraryname/Forms/Button.udcx"
  11. Make sure you have checked the option "Relative to site collection" and click ok
  12. If you are querying for some thing from web service you have to change the rest url to do so
  13. click on the action for Button in my case you can see change rest url option in the action as shwon in fig above
  14. change the URL based on a formula here am querying on project id and phaseid, so here set it to: concat("http://pesdd:7789/GlobalService.svc/PhaseDataByProjectAndPhaseID?prjct_id=", Prjct_ID, "&phs_id=", Phase_Id) Click on ok
  15. add query for data in action and select rest web service and click ok
  16. go to the data connection library where you created udcx file and right click on the file and make sure to approve it.
  17. before publishing the form for rest web services follow these steps

  18. go to central admin --> Genereal application settings --> Infopath Form services -->Configure infopath form services --> check "Allow cross-domain data access for user form templates that use connection settings in a data connection file" and "Allow user form templates to use authentication information contained in data connection files " and check them and click ok

  19. Publish the form and you are good to go in getting the values from desired restweb service.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.