M
moody2010
Hi,
I don't know if this is the right place to ask my question, but I've been
trying to figure out a solution to this for a while now.
Basically I want to implement a feature where the approval status of an item
(in this case a form that's uploaded from infopath) is automatically updated
and set to approved when the user (in this case a manager) clicks a button in
the form. So when the manager opens up the infopath form in sharepoint and
clicks the "add to calendar" button in it, the approval status of this form
is set to approved. This prevents the manager from manually going back to
sharepoint and selecting the form and approving it. For some reason I'm
having trouble accomplishing this.
Here's what I have so far. This is what I have in my CAML file:
<?xml version="1.0" encoding="UTF-8" ?>
- <Batch>
- <Method ID="1" Cmd="Moderate">
<Field Name="Title" />
<Field Name="EventDate" />
<Field Name="EndDate" />
<Field Name="fAllDayEvent" />
<Field Name="_ModerationStatus">0</Field>
</Method>
</Batch>
Here's the code for the "add to calendar" button for the infopath form:
function CTRL34_5::OnClick(eventObj)
{
try{
var leaves = XDocument.DOM.selectNodes("//my:leaves/my:leave");
for (l=0;l<leaves.length;l++){
var caml = XDocument.DataObjects["EventCAML"].DOM;
var fields = caml.selectNodes("/Batch/Method/Field");
//loop through each field in the CAML
for (i=0; i<fields.length; i++){
if (fields(i).attributes[0].text == "Title"){
fields(i).text=(XDocument.DOM.selectSingleNode("//my:Employee_Name").text);
}
if (fields(i).attributes[0].text == "EventDate")
fields(i).text=leaves(l).selectSingleNode("my:Start_Date").text;
if (fields(i).attributes[0].text == "EndDate") {
fields(i).text=leaves(l).selectSingleNode("my:End_Date").text;
}
if (fields(i).attributes[0].text == "fAllDayEvent") {
fields(i).text="True";
}
if (fields(i).attributes[0].text == "_ModerationStatus") {}
}
// submit data
sharepoint=XDocument.DataAdapters["Web Service Submit"];
sharepoint.Submit();
}
I don't know if what I have so far is correct or not. So any help is greatly
appreciated.
Thanks..
I don't know if this is the right place to ask my question, but I've been
trying to figure out a solution to this for a while now.
Basically I want to implement a feature where the approval status of an item
(in this case a form that's uploaded from infopath) is automatically updated
and set to approved when the user (in this case a manager) clicks a button in
the form. So when the manager opens up the infopath form in sharepoint and
clicks the "add to calendar" button in it, the approval status of this form
is set to approved. This prevents the manager from manually going back to
sharepoint and selecting the form and approving it. For some reason I'm
having trouble accomplishing this.
Here's what I have so far. This is what I have in my CAML file:
<?xml version="1.0" encoding="UTF-8" ?>
- <Batch>
- <Method ID="1" Cmd="Moderate">
<Field Name="Title" />
<Field Name="EventDate" />
<Field Name="EndDate" />
<Field Name="fAllDayEvent" />
<Field Name="_ModerationStatus">0</Field>
</Method>
</Batch>
Here's the code for the "add to calendar" button for the infopath form:
function CTRL34_5::OnClick(eventObj)
{
try{
var leaves = XDocument.DOM.selectNodes("//my:leaves/my:leave");
for (l=0;l<leaves.length;l++){
var caml = XDocument.DataObjects["EventCAML"].DOM;
var fields = caml.selectNodes("/Batch/Method/Field");
//loop through each field in the CAML
for (i=0; i<fields.length; i++){
if (fields(i).attributes[0].text == "Title"){
fields(i).text=(XDocument.DOM.selectSingleNode("//my:Employee_Name").text);
}
if (fields(i).attributes[0].text == "EventDate")
fields(i).text=leaves(l).selectSingleNode("my:Start_Date").text;
if (fields(i).attributes[0].text == "EndDate") {
fields(i).text=leaves(l).selectSingleNode("my:End_Date").text;
}
if (fields(i).attributes[0].text == "fAllDayEvent") {
fields(i).text="True";
}
if (fields(i).attributes[0].text == "_ModerationStatus") {}
}
// submit data
sharepoint=XDocument.DataAdapters["Web Service Submit"];
sharepoint.Submit();
}
I don't know if what I have so far is correct or not. So any help is greatly
appreciated.
Thanks..