Now I am going to show all the process step by step
- In infopath go to data connections click add new connections select receive data
On the menu select from XML Document than browse your exported files and find your CAMLGuestNew.xml (your CAML files name might be different any name you give when you create it) file and click add.
- In Infopath go to data connection click add new connection select submit data
Selection options to Web Service in the URL box past: http://YourServerName/_vti_bin/lists.asmx?WSDL
Click next than select UpdateListItem click next
Double click in tns:listName
A window comes like bellow
I select GUIDguestList field. This field I have already set the default value to GUID of Guest list
Now I click in tns:updates
I change the connection to my CAML Batch file then select Batch and click ok
In the include: I select second options you can see in below image
Than next and give the connection a name and close
- Now I click on the button where I want to add action than go to manage rules
Add new action rule
In set field values
In fields double click the icon I go to my batch file connection and expand and select the field then click ok
In the value field select the field you want to update.
Once you set all the fields values to be updated by CAML
then add submit using data acconnection
in the data connection select the XML connection which we made at the beginning
I made one http://YourServerName/_vti_bin/lists.asmx?WSDL submit to web service named it web service CAMLGuestNew.
Then go to publish again and export source files
Change the manifest.xsf to manifest.xml and open it with Wordpad or any text, xml editor
Find the rule you have created for set fields values
In my button I named my rule set CAML Values
In manifest.xml file my rule comes like bellow code:
<xsf:rule caption=”set CAML Values” condition=”../my:GuestInfo/my:GuestLastName != "" and ../my:GuestInfo/my:GuestType != "" and ../my:GuestInfo/my:GuestTitle != ""” isEnabled=”yes”>
<xsf:assignmentAction targetField=”xdXDocument:GetDOM("CAMguestNew")/Batch/Method/Field” expression=”my:EventNumber”></xsf:assignmentAction>
<xsf:assignmentAction targetField=”xdXDocument:GetDOM("CAMguestNew")/Batch/Method/Field” expression=”my:EventDate”></xsf:assignmentAction>
<xsf:assignmentAction targetField=”xdXDocument:GetDOM("CAMguestNew")/Batch/Method/Field” expression=”my:EventLocation”></xsf:assignmentAction>
<xsf:assignmentAction targetField=”xdXDocument:GetDOM("CAMguestNew")/Batch/Method/Field” expression=”my:EventPurpose”></xsf:assignmentAction>
<xsf:assignmentAction targetField=”xdXDocument:GetDOM("CAMguestNew")/Batch/Method/Field” expression=”../my:GuestInfo/my:GuestType”></xsf:assignmentAction>
<xsf:assignmentAction targetField=”xdXDocument:GetDOM("CAMguestNew")/Batch/Method/Field” expression=”../my:GuestInfo/my:GuestLastName”></xsf:assignmentAction>
<xsf:assignmentAction targetField=”xdXDocument:GetDOM("CAMguestNew")/Batch/Method/Field” expression=”../my:GuestInfo/my:GuestFirstName”></xsf:assignmentAction>
<xsf:assignmentAction targetField=”xdXDocument:GetDOM("CAMguestNew")/Batch/Method/Field” expression=”../my:GuestInfo/my:GuestTitle”></xsf:assignmentAction>
<xsf:assignmentAction targetField=”xdXDocument:GetDOM("CAMguestNew")/Batch/Method/Field” expression=”my:EventMealType”></xsf:assignmentAction>
<xsf:assignmentAction targetField=”xdXDocument:GetDOM("CAMguestNew")/Batch/Method/Field” expression=”my:EventCost”></xsf:assignmentAction>
</xsf:rule>
After the field which I highlight it in red color past bellow code: [@Name = "FieldName"]
Than change with your fields name in your Batch xml file
The batch xml file codes are like bellow
<?xml version=”1.0″ encoding=”UTF-8″?>
<Batch OnError=”Continue”> <Method ID=”1″ Cmd=”New”> <Field Name=”EventGiftRefID”></Field> <Field Name=”Date”></Field> <Field Name=”DFAClocation”></Field> <Field Name=”Purpose”></Field> <Field Name=”GuestType”></Field> <Field Name=”LastName”></Field> <Field Name=”FirstName”></Field> <Field Name=”PositionTitle”></Field> <Field Name=”MealType”></Field> <Field Name=”Cost”></Field> <Field Name=”DFACvoucherLookup”></Field> </Method> </Batch> |
Your code will become like bellow code:
<xsf:rule caption=”set CAML Values” condition=”../my:GuestInfo/my:GuestLastName != "" and ../my:GuestInfo/my:GuestType != "" and ../my:GuestInfo/my:GuestTitle != ""” isEnabled=”yes”>
<xsf:assignmentAction targetField=”xdXDocument:GetDOM("CAMguestNew")/Batch/Method/Field[@Name = "EventGiftRefID"]” expression=”my:EventNumber”></xsf:assignmentAction>
<xsf:assignmentAction targetField=”xdXDocument:GetDOM("CAMguestNew")/Batch/Method/Field[@Name = "Date"]” expression=”my:EventDate”></xsf:assignmentAction>
<xsf:assignmentAction targetField=”xdXDocument:GetDOM("CAMguestNew")/Batch/Method/Field[@Name = "DFAClocation"]” expression=”my:EventLocation”></xsf:assignmentAction>
<xsf:assignmentAction targetField=”xdXDocument:GetDOM("CAMguestNew")/Batch/Method/Field[@Name = "Purpose"]” expression=”my:EventPurpose”></xsf:assignmentAction>
<xsf:assignmentAction targetField=”xdXDocument:GetDOM("CAMguestNew")/Batch/Method/Field[@Name = "GuestType"]” expression=”../my:GuestInfo/my:GuestType”></xsf:assignmentAction>
<xsf:assignmentAction targetField=”xdXDocument:GetDOM("CAMguestNew")/Batch/Method/Field[@Name = "LastName"]” expression=”../my:GuestInfo/my:GuestLastName”></xsf:assignmentAction>
<xsf:assignmentAction targetField=”xdXDocument:GetDOM("CAMguestNew")/Batch/Method/Field[@Name = "FirstName"]” expression=”../my:GuestInfo/my:GuestFirstName”></xsf:assignmentAction>
<xsf:assignmentAction targetField=”xdXDocument:GetDOM("CAMguestNew")/Batch/Method/Field[@Name = "PositionTitle"]” expression=”../my:GuestInfo/my:GuestTitle”></xsf:assignmentAction>
<xsf:assignmentAction targetField=”xdXDocument:GetDOM("CAMguestNew")/Batch/Method/Field[@Name = "MealType"]” expression=”my:EventMealType”></xsf:assignmentAction>
<xsf:assignmentAction targetField=”xdXDocument:GetDOM("CAMguestNew")/Batch/Method/Field[@Name = "Cost"]” expression=”my:EventCost”></xsf:assignmentAction>
</xsf:rule>
To test your code working or not open your manifest.xsf file after modifications in InfoPath designer go to your connections and select the batch file and expand it and add repeating table
1- The CAMguestNew.xml file Add new items contains:
<?xml version=”1.0″ encoding=”UTF-8″?>
<Batch OnError=”Continue”>
<Method ID=”1″ Cmd=”New”>
<Field Name=”EventGiftRefID”></Field>
<Field Name=”Date”></Field>
<Field Name=”DFAClocation”></Field>
<Field Name=”Purpose”></Field>
<Field Name=”GuestType”></Field>
<Field Name=”LastName”></Field>
<Field Name=”FirstName”></Field>
<Field Name=”PositionTitle”></Field>
<Field Name=”MealType”></Field>
<Field Name=”Cost”></Field>
<Field Name=”DFACvoucherLookup”></Field>
</Method>
</Batch>
==========================================================
2- The CAMguestUpdate.xml file update item contains:
<?xml version=”1.0″ encoding=”UTF-8″?>
<Batch OnError=”Continue”>
<Method ID=”1″ Cmd=”Update”>
<Field Name=”ID”></Field>
<Field Name=”EventGiftRefID”></Field>
<Field Name=”Date”></Field>
<Field Name=”DFAClocation”></Field>
<Field Name=”Purpose”></Field>
<Field Name=”GuestType”></Field>
<Field Name=”LastName”></Field>
<Field Name=”FirstName”></Field>
<Field Name=”PositionTitle”></Field>
<Field Name=”MealType”></Field>
<Field Name=”Cost”></Field>
<Field Name=”DFACvoucherLookup”></Field>
</Method>
</Batch>
========================================================
3- CAMDelete.xml file contains:
<?xml version=”1.0″ encoding=”UTF-8″?>
<Batch OnError=”Continue”>
<Method ID=”1″ Cmd=”Delete”>
<Field Name=”ID”></Field>
</Method>
</Batch>
Hi – This quite informative, but I think some of these steps are missing example images.
Thanks
LikeLike