- Object.Retrieve methods for CRM business objects
- Posted by Chris Ericoli on May 28th, 2004
Hi,
I am coding up some work currently, and have a relatively simple question
relating to the .Retrieve method of the CRM business objects, such as
CRMQuote.
I am trying to manipulate the data contained in the CRMQuote entity, and the
simplest way is for me to read the xml string returned by the retrieve
method into a dataset. The problem that I am facing is that I require that
all of the columns are returned for the entity. The SDK suggests this is
possible by simply passing a blank string or null paramater to the Retrieve
method
{from the SDK}
--
Public Function Retrieve(
ByVal Caller As CUserAuth,
ByVal QuoteId As String,
ByVal ColumnSetXml As String
) As String
ColumnSetXml
Specifies an XML string describing the set of columns that is to be
retrieved. Passing "" or null returns all columns.
--
However, it would appear that the retrieve method only returns columns that
contain data. Any columns that do not contain data are not included in the
returned columnset, and therefore not created in my dataset datatable.
If anyone can help me with this and let me know whether there is a means of
returning all columns regardless of whether they retain values, that would
be greatly appreciated.
Cheers
Chris
- Posted by Monika on May 28th, 2004
Hi,
How does you query look like? I have been doing some
query stuff and there are not all reliable in the
documentation.
Monika
- Posted by Vinícius Pitta Lima de Araújo on May 28th, 2004
Hi,
Try the use a null filter as follow:
NullFilterXml :=
<filter
column='column-name'
operator=('null' | 'not-null') />
Notice: When you put the xml into a dataset, if the tag have attributes it
will mapped to a table.
Example:
<activities>
<activity>
<subject>Eu AMO MARIANA.</subject>
<scheduledstart date='28/05/2004'
Time='09:10">2004-05-28T09:10:00</scheduledstart>
</activity>
</activities>
Whe you load this in the dataset will get the tables:
Table: activity
Columns: activity_Id (auto-generated by dataset), subject
Tables: scheduledstart
Columns: activity_Id, date, time, scheduledstart_Text
Relations: activity_scheduledstart (activity_Id vs activity_Id)
I hope who that help.
[]'s
Vinícius Pitta Lima de Araújo
"Chris Ericoli" <cericoliNOspm@removethisfamill.com.au> escreveu na mensagem
news:40b6da9e$1@dnews.tpgi.com.au...
- Posted by Chris Ericoli on May 29th, 2004
Hi Monika
Thank you for your reply, however I am not using the CRMquery object, but
rather the Retrieve method of the CRMQuote object, as such there is no Fetch
XML schema, merely a ColumnSet XML string:
Public Function ReturnQuoteByID(ByVal oID As String) As DataTable
Dim crmQuote As New Microsoft.CRM.Proxy.CRMQuote
Dim Results As String
Dim dsResults As New DataSet
Try
crmQuote.Credentials = credAdmin
crmQuote.Url = srvDirectory + "CRMQuote.srf"
Results = crmQuote.Retrieve(CUserAuth, oID, "")
dsResults.ReadXml(New IO.StringReader(Results))
Return dsResults.Tables("quote")
Catch soapex As Web.Services.Protocols.SoapException
Catch ex As Exception
End Try
End Function
"Monika" <anonymous@discussions.microsoft.com> wrote in message
news:1424601c4448b$b44e4db0$a101280a@phx.gbl...
- Posted by Chris Ericoli on May 29th, 2004
Hi Vinicius,
I had thought about using a CRMQuery object rather than the Retrieve method
exactly because i thought the null filter might work. But on further
reading, it appears that there are two problems - one is that I would have
to specifiy all of the columns that I require, when I actually require all
of them, and secondly that the null filter I believe is there to return rows
only when they meet the condition, ie contain null or not null.
Cheers
Chris
"Vinícius Pitta Lima de Araújo" <vinipitta@yahoo.com.br> wrote in message
news:Omz7P2KREHA.1620@TK2MSFTNGP12.phx.gbl...
- Posted by Mj Miller on June 2nd, 2004
That's by design. You might want to look at using something other that
ADO.Net. The XML returned from the platform has been trimmed down to be as
small as possible. There was a lot of debate on the team about how to handle
this and the 'smaller-is-better' crowd won.
"Chris Ericoli" <cericoliNOspm@removethisfamill.com.au> wrote in message
news:40b6da9e$1@dnews.tpgi.com.au...