CAML update running, but not changing data (Sharepoint 2007) - sharepoint-2007

I've been trying to create a batch update program for a MOSS site, based on the MSDN example here: http://msdn.microsoft.com/en-us/library/cc404818.aspx. Unfortunately, although the update query is running through with no errors, the data in the list is not changing.
Here is the batch command I use:
<Method ID="3767">
<SetList>8468cf0a-7e10-439c-a9b4-4197543e7b38</SetList>
<SetVar Name="Cmd">Save</SetVar>
<SetVar Name="ID">3767</SetVar>
<SetVar Name="Date_x0020_of_x0020_Birth1">1971-12-18T00:00:00Z</SetVar>
</Method>
Upon running the batch update command:
string batchReturn = web.ProcessBatchData(batch);
returns:
<Results>
<Result ID="3767" Code="0"></Result>
</Results>
The major version number on the list item is incremented, but no changes are made to the data in field: Date_x0020_of_x0020_Birth1
I'm stumped.
More background: Date_x0020_of_x0020_Birth1 is a new field added to the default content type fo this list. It is a DateTime field. It supercedes the original Date_x0020_of_x0020_Birth field (now has a display name of "Date of Birth(Text)") which was a text field, dues o it containing values prior to 01/01/1900. The batch update is to copy dates from the text field to the new DateTime field where possible.
The only thing I can think off is that I'm using:
<SetVar Name="Cmd">Save</SetVar>
Perhaps I need the "Update" or "Save" command, so I tried this:
<Method ID="1" Cmd="Update">
<Field Name='ID'>3767</Field>
<Field Name="Date_x0020_of_x0020_Birth1">1971-12-18T00:00:00Z</Field>
</Method>
But that returns:
<Results>37671971-12-18T00:00:00Z<Result ID="1" Code="-2130575350">
<ErrorText>Invalid URL Parameter
The URL provided contains an invalid Command or Value. Please check the URL again.
</ErrorText>
</Result>
3767Date_x0020_of_x0020_Birth1
<Result ID="1" Code="-2147023673">
<ErrorText>The operation failed because an unexpected error occurred. (Result Code: 0x800704c7)</ErrorText>
</Result>
</Results>

"Update" is the right CMD, and it sounds like the update is occuring fine (updating the version number).
That just leaves the field, and it is probably the "Name" you are using.
Did you try using the urn prefix (urn:schemas-microsoft-com:office:office#Date_x0020_of_x0020_Birth1)
Can you try updating a different field, like the title. (urn:schemas-microsoft-com:office:office#Title)
If that all fails you could try using the UpdateListItems on the lists.asmx

Related

Custom column using not displayed field (but available in CDS)

I've created a list report, to which I've extended by adding some custom columns. The problem I'm facing is that my custom columns only work when the CDS field behind it (bind) is being displayed at the standard columns.
I.e
<Column id="ExtensionWizard::Attachments" xmlns="sap.ui.table" width="3em">
...
<Button icon="{= ${dmsDocumentCount} === 0 ? 'sap-icon://warning' : 'sap-icon://attachment' }"
xmlns="sap.m" press="onDisplayAttachments"/>
...
</Column>
Displays this:
And only if I display the dmsDocumentCount column I have the desired output:
I could see that this happens because the oData service is not being requested to return the dmsDocumentCount field.
So your answer can go both ways:
How to force this field to be requested by the OData. Remember I'm extending a list report.
How to achieve the the result (or similar).
Thank you very much for your answers
In your UI.LineItem annotation you can add the UI.Hidden annotation term such as
<Record Type="UI.DataField">
<PropertyValue Property="Value" Path="dmsDocumentCount"/>
<Annotation Term="UI.Hidden" Bool="true"/>
</Record>
The field will be requested but not shown in the table.

Parse HTML stored as string in Database in ColdFusion

I have taken over this ColdFusion project and found that I need a value out of a database field that includes HTML. The field data looks like this (without the new lines):
<wddxPacket version="1.0">
<header />
<data>
<struct>
<var name="en">
<string>3 Nights' Lodging</string>
</var>
<var name="sp">
<string>3 Noches alojamiento</string>
</var>
</struct>
</data>
</wddxPacket>
I am wanting to use this data but I only need the text between the:
<var name='en'><string>3 Nights' Lodging</string></var>
I used a function that ColdFusion has to remove HTML:
#REReplaceNoCase(pkg.title, "<[^><]*>", '', 'ALL')#
But when I use that, I get something like this:
3 Nights' Lodging3 Noches alojamiento
All I want is:
3 Nights' Lodging
Examining the beginning of the string, ie <wddxPacket ...> it is actually WDDX.
If you do a search for ColdFusion + WDDX you will find the documentation for CFWDDX. It is a built in tag which supports conversions of WDDX strings to CFML objects (and vice versa) for easier manipulation. In your case use action="wddx2cfml" to convert the string back into a CF structure.
<cfwddx action="wddx2cfml" input="#text#" output="result">
<cfdump var="#result#" label="Raw object">
Then use the key #result.en# to grab the string you want.

client side validation and tooltip

I have jsf validation on form where the invalid fields are highlighted based on
styleClass="#{component.valid ? 'reportInput' : 'reportInput_invalid'}"
and a tooltip is being used for displaying the error message as follows
<p:tooltip for="inputFieldId">
<p:message for="inputFieldId" />
</p:tooltip>
Everything works as expected but i want to improve user experience and want to introduce pure client side validation using
<p:clientValidator />
I tried this but it didnt work when onBlur event is fired on inputfield i got the following JS error
'null' is Null or no Object
in validation.js.jsf and the line code is
d.data("uiMessageId",b.attr("id"))
Is it possible to achieve?
An example of my input field is:
<p:inputText id="bic"
styleClass="#{component.valid ? 'reportInput' : 'reportInput_invalid'}"
value="#{bean.bic}"
required="true" requiredMessage="Field value is required" >
<p:watermark for="bic" value="CMHJKLIL" />
<pe:keyFilter regEx="/[a-z0-9]/i" />
<f:validateLength minimum="8" />
<p:clientValidator/>
</p:inputText>
I am using Primefaces 4 with the following maven dependency
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>4.0</version>
</dependency>
Here as it looks in jsf page head section
Here is the validation.js file that is being used
validatuion.js here
i had the exact same error.
it seems that the validator.js code searches for a message container attached to the field, and, if cant find one, it searches one in the nearest form "e.findUIMessage(a,d.closest("form").find("div.ui-message"))"
what you need is to have an tag,
that is, a message assigned for the inputtext, so, when the validator generates an error, it can post the text in that message container.

Fetching attribute value from property using ant - may be with propertyregex

I tried using linecontainsregexp within filterchain ant-task by framing regexp pattern holding unique server name say 'act1' & now property holds value like this:
<Server name="act1" value="ServerName" port="1234"></Server>
How to get individual attribute names?. For eg if I want to get port #, how to retrieve it. I tried with something like:
<propertyregex property="extracted.prop" input="${server.details}"
regexp="(.*)\\ *##" select="\1" />
thank you.
The code below should work to extract each of the three attributes. First, notice that I'm loading the entire xml file. It isn't necessary to extract the specific line as you were doing. Secondly, I wrote it to be flexible enough to allow line breaks in the Server properties and to allow any order of the attributes.
I see that you were really struggling with the regex in particular. For your understanding, I'll break down the first regex:
(?s) // DOTALL flag. Causes the . wildcard to match newlines.
\x3c // The < character. For reasons I don't understand, `propertyregex` doesn't allow <
Server // Match 'Server' literally
.*? // Reluctantly consume characters until...
name= // 'name=' is reached
" // Because ant is an XML file, we must use this escape sequence for "
(.*?) // Reluctantly grab all characters in a capturing group until...
" // another double quote is reached.
And finally the XML:
<loadfile property="server.details" srcfile="${baseDir}/build/myTest.xml"/>
<propertyregex property="server.name"
input="${server.details}"
regexp="(?s)\x3cServer.*?name="(.*?)""
select="\1" />
<propertyregex property="server.value"
input="${server.details}"
regexp="(?s)\x3cServer.*?value="(.*?)""
select="\1" />
<propertyregex property="server.port"
input="${server.details}"
regexp="(?s)\x3cServer.*?port="(.*?)""
select="\1" />

quickbooks vendor credit error message

When I sent the following XML to QuickBooks Desktop cloud, I received the following error which I don't understand. Googled but didn't find anything relating. Does anyone know what the source column is?
error message received:
p_validate_txn_ln - unable to find src_column_name_id per ref id acc_id = 39 idDomain = QB
<Object xsi:type="VendorCredit"><Header>
<DocNumber>8D1FC366607</DocNumber>
<TxnDate>2013-09-11</TxnDate>
<Note>Expense Report 09/11/2013 #2</Note>
<VendorName>E100</VendorName>
<TotalAmt>-25.00</TotalAmt>
<APAccountName>Accounts Payable</APAccountName></Header>
<Line>
<Desc>Airfare:</Desc>
<Amount>25.00</Amount>
<ClassId idDomain="QB">5</ClassId>
<ReimbursableInfo>
<CustomerId idDomain="QB">5</CustomerId>
<JobId idDomain="QB">6</JobId>
</ReimbursableInfo>
<BillableStatus>NotBillable</BillableStatus>
<AccountId idDomain="QB">39</AccountId>
</Line>
</Object>
After not including AccountId or ItemId, I was able to send the create VendorCredit object fine. Got success response. However after I ran sync manager, go to QB Desktop, find the Account, the vendorCredit is not there. Any advice?
XML sent:
<Object xsi:type="VendorCredit">
<Header>
<DocNumber>58B58878D79</DocNumber>
<TxnDate>2013-09-12</TxnDate>
<Note>Expense Report 09/12/2013 #2</Note>
<VendorName>E100</VendorName>
<TotalAmt>-43.80</TotalAmt>
<APAccountName>Accounts Payable</APAccountName>
</Header>
<Line>
<Desc>Advertising:</Desc>
<Amount>43.80</Amount>
<ClassId idDomain="QB">1</ClassId>
<ReimbursableInfo>
<CustomerId idDomain="QB">4</CustomerId>
<JobId idDomain="QB">8</JobId>
</ReimbursableInfo>
</Line>
</Object>
Response received:
<?xml version="1.0" encoding="UTF-8"?>
<RestResponse>
<Success RequestId="4a3f1538a01b4a4dac6f03406c6710c7">
<VendorCredit>
<Id idDomain="NG">14542796</Id>
<SyncToken>1</SyncToken>
<MetaData>
<CreatedBy>app</CreatedBy>
<CreateTime>2013-09-12T23:41:38Z</CreateTime>
<LastModifiedBy>app</LastModifiedBy>
<LastUpdatedTime>2013-09-12T23:41:38Z</LastUpdatedTime>
</MetaData>
<Synchronized>false</Synchronized>
<Header>
<DocNumber>58B58878D79</DocNumber>
<TxnDate>2013-09-12T00:00:00Z</TxnDate>
<Note>Expense Report 09/12/2013 #2</Note>
<VendorName>E100</VendorName>
<TotalAmt>-43.8</TotalAmt>
<APAccountName>Accounts Payable</APAccountName>
</Header>
<Line>
<Id idDomain="NG">50786642</Id>
<Desc>Advertising:</Desc>
<Amount>43.8</Amount>
<ClassId idDomain="QB">1</ClassId>
<ReimbursableInfo>
< CustomerId idDomain="QB">4</CustomerId>
<JobId idDomain="QB">8</JobId>
</ReimbursableInfo>
</Line>
</VendorCredit>
<RequestName>VendorCreditAdd</RequestName><ProcessedTime>2013-09-12T23:41:38Z</ProcessedTime>
</Success>
</RestResponse>
Although the docs mention AccountId as a required field, it is not(the docs might be slightly off). You can ignore it. if you chooss to add it then all fields related to Items need to included.
Instead ItemId is a required field. So, please include it in your request.
Please refer:
https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/v2/0500_quickbooks_windows/0600_object_reference/vendorcredit
I created a vendor create request as follows and was able to get the correct response.
Request-
<Add xmlns="http://www.intuit.com/sb/cdm/v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" RequestId="Szey2z7hrGf888888888jfc5hrGSYg99" xsi:schemaLocation="http://www.intuit.com/sb/cdm/v2 ./RestDataFilter.xsd">
<Object xsi:type="VendorCredit">
<Header>
<DocNumber>8D1FC366607</DocNumber>
<TxnDate>2013-09-11</TxnDate>
<Note>Expense Report 09/11/2013 #2</Note>
<VendorName>TestVendor4</VendorName>
<TotalAmt>-25.00</TotalAmt>
<APAccountName>Accounts Payable</APAccountName>
</Header>
<Line>
<Desc>Airfare:</Desc>
<Amount>25.00</Amount>
<ClassId idDomain="QB">1</ClassId>
<ReimbursableInfo>
<CustomerId idDomain="QB">31</CustomerId>
</ReimbursableInfo>
<BillableStatus>NotBillable</BillableStatus>
<ItemId idDomain="QB">12</ItemId>
</Line>
</Object>
</Add>
Response-
<RestResponse xmlns="http://www.intuit.com/sb/cdm/v2">
<Success RequestId="Szey2z7hrGf888888888jfc5hrGSYg99">
<ObjectRef>
<Id idDomain="NG">1925041</Id>
<SyncToken>1</SyncToken>
<LastUpdatedTime>2013-09-12T07:50:34Z</LastUpdatedTime>
</ObjectRef>
<RequestName>VendorCreditAdd</RequestName>
<ProcessedTime>2013-09-12T07:50:34Z</ProcessedTime>
</Success>
</RestResponse>
Edit for the questions asked:
*Please note:*
VendorCredit is an AP transaction representing a credit from a third party for returned goods or services not rendered. In QuickBooks desktop versions, a vendor credit is also known as a "bill credit". That is, it is a credit that a vendor owes you because you overpaid your bill, returned merchandise, or for some other reason. The VendorCredit is not applied until it is referenced in a Bill Payment transaction.
Note: A VendorCredit should not be confused with a Credit Memo, which is something you owe your customer
ItemId refers to those items for which the credit is made. You can get the ItemId by calling the Item api in QBD. Refer is in your request here.
Since, you are not mentioning the itemid in your request xml, you got the response but the sync to QB desktop file failed. You Vendor credit object must have errored out.
To check if the entity is in an error state, you can check by executing a query and setting ErroredObjectsOnly="true".
http://docs.developer.intuit.com/0025_Intuit_Anywhere/0050_Data_Services/v2/0500_QuickBooks_Windows/0100_Calling_Data_Services/0015_Retrieving_Objects#Objects_in_Error_State
If the entity is in error state, you can query for the specific reason using the SyncStatus API:
http://docs.developer.intuit.com/0025_Intuit_Anywhere/0050_Data_Services/v2/0500_QuickBooks_Windows/0600_Object_Reference/SyncStatus
Please add the itemid reference in your request and it should work.
http://support.quickbooks.intuit.com/support/articles/SLN74445
QuickBooks has detected that you have no items When trying to enter an Invoice or a Sales Receipt without an item this warning is received:
QuickBooks has detected that you have no items or that one or more of your amounts are not associated with items. Please enter an item.
Why this is happening
If "Require Accounts" is checked in the Preferences this warning will occur.
How to fix it
To be able to enter in an Invoice or Sales Receipt without an Item on it:
1. Click the Edit Menu.
2. Click Preferences...
3. Click Accounting Preference> Company Preferences.
4. Uncheck Require accounts.
5. Click OK.
You will now be able to enter an Invoice or a Sales Receipt without an item on it.

Resources