SubmitToSharePointList dynamically - InfoPath Dev
in

InfoPath Dev

SubmitToSharePointList dynamically

Last post 02-23-2015 09:30 AM by Hilary Stoupa. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 02-23-2015 05:54 AM

    SubmitToSharePointList dynamically

     

    Hi everybody.

     

    Actually I’m able to :

     

    Fill a form that will be saved to a different Library depending on the type of “name” I give to the form.

     

    So if the formname is “NonConformity”, it will be saved in by example : http://atx-ee/cr/quality/NonCon

    If the formname is “Azioni Correttive” it will be saved in by example : http://atx-ee3/cr/quality/AC

    If the formname is “PCN” it fill be saved in by example : http://atx-ee3/ProductChangeNotification

     

    Inside every form there Is a repeated table that contains the Action Plan, so one or more records that contains tasks that have to be performed by someone.

     

    Those tasks are actually saved in one place by example : http://atx-ee3/tasks

     

    I have created a mapping, with mappingname and so I’m able also to select another place where to save those tasks.

     

     

    Since I have let say 10 subsites , one for each project .

     

    The most affordable ( for me ) solution could be to create a mapping with 10 different mapping name and select the mapping name at submit time.

     

    Another solution could be :

     

    Have a dropdown list that retrieve the sub-site name ( with its GUID and related informations )

    Since the mapping of the tasks is the same for every site, I could use one single mapping  … ?

    Where I change just the two highlined fields ?

     

     

    How could I perform this ?

    Which are the fields that should contain the highlined info or the command ?

     

     

    <?xml version="1.0" encoding="utf-16"?>

    <myFields schemaVersion="6.1">

      <Mappings mappingName="Attività">

        <Properties>

          <Level>0</Level>

          <ParentMapping />

        </Properties>

        <ListCollection useName="true" ListName="Attività">{90ABED44-BDBA-4ED8-987A-AF2B46326BA4}</ListCollection>

        <IsRepeating>true</IsRepeating>

        <RepeatingGroup>my:myFields/my:ActionItems/my:Actions</RepeatingGroup>

        <Relationships>

          <RelatedList />

          <RelatedListId />

        </Relationships>

        <Mapping>

          <FormField IsRichText="false" IsId="false" IsAttachment="false" IsDate="false" IsParentId="false">my:ActionTitle</FormField>

          <SharePointColumn>Title</SharePointColumn>

        </Mapping>

        <Mapping>

          <FormField IsRichText="false" IsId="false" IsAttachment="false" IsDate="false" IsParentId="false">my:ActionAssignedTo</FormField>

          <SharePointColumn>AssignedTo</SharePointColumn>

        </Mapping>

        <Mapping>

          <FormField IsRichText="false" IsId="false" IsAttachment="false" IsDate="false" IsParentId="false">my:ActionDescription</FormField>

          <SharePointColumn>Body</SharePointColumn>

        </Mapping>

        <Mapping>

          <FormField IsRichText="false" IsId="false" IsAttachment="false" IsDate="false" IsParentId="false">my:ActionDueDate</FormField>

          <SharePointColumn>DueDate</SharePointColumn>

        </Mapping>

        <Batch OnError="Continue">

          <Method ID="1" Cmd="New">

            <Field Name="Title" />

            <Field Name="AssignedTo" />

            <Field Name="Body" />

            <Field Name="DueDate" />

          </Method>

        </Batch>

      </Mappings>

      <SharePointListURL>http://atx-ee3</SharePointListURL>

    </myFields>

     

     

     

     

     

    Thank so much for your help

  • 02-23-2015 07:48 AM In reply to

    Re: SubmitToSharePointList dynamically

    Hi - do all the lists have the same column? Since in your mapping you have useListName = true, you can just use a rule to change the list name and you won't have to worry about the GUID. Since all your lists seem to be on the same site, you shouldn't have to change the URL. Simply modify the ListName attribute in the ListConnection node via a rule prior to executing the SubmitToSharePointList Command:

    ListName="Attività"

     

    Hilary Stoupa

  • 02-23-2015 08:06 AM In reply to

    Re: SubmitToSharePointList dynamically

    The mapping i used was the preliminar one, where two destinations were enough.  Then  I thought : why not insert the tasks directly into the correct project task list ? 

     This is my actual situation:

      List name is Always the same :  Attività                     means :  Tasks

    In every sub-site ( i got few dozens ) I have the same structure of lists , so I have a list named Attività in every sub-site

     What I do not know is how I can inform qrules to save to the list ( Always named Attività ) in the sub-site named  http://atx-ee3/cr/progetti/ATX_001 002   003   ABC   etcetera

     My idea was to start with a dropdown list that  asks me which project I'm dealing with, and then with the subsite informations retrieved I can instruct Qrules where to put the task items.

    Thanks for your prompt  reply.

     

    Roberto  

     

  • 02-23-2015 08:15 AM In reply to

    Re: SubmitToSharePointList dynamically

    Oh, okay - I misunderstood. In this case you do want to change the SharePoint URL in the mapping file via a regular InfoPath rule prior to executing the command. Change it to the correct sub-site:

    <SharePointListURL>http://atx-ee3</SharePointListURL>

    Hilary Stoupa

  • 02-23-2015 09:24 AM In reply to

    Re: SubmitToSharePointList dynamically

     Perfect.

    With this command I'd been able to redirect the tasks to the correct list.

     

    What about the possibility to get the list of all the - sub sites and lists in the  site ?

     

    Is it possible ?

     

    Thanks again

     

    Roberto 

     

     

  • 02-23-2015 09:30 AM In reply to

    Re: SubmitToSharePointList dynamically

    https://msdn.microsoft.com/en-us/library/lists.lists.getlistcollection(v=office.12).aspx

    The GetListCollection method of the Lists webservice in SharePoint will return all the lists - but since IP won't create a schema for the returned data, you have to use hand written XPaths to get the values back.

    There may be a web service that returns the subsites: https://msdn.microsoft.com/en-us/library/dd878586(v=office.12).aspx

    Depending on what version of SharePoint you are using, the REST API may also be helpful: https://msdn.microsoft.com/en-us/library/office/jj860569.aspx

    Hilary Stoupa

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