locked
Some questions please, can't find the answer on the net, thank you. RRS feed

  • Question

  • Based so far on what I have gathered, if CRM columns have values of NULL, it won't be returned by the service methods (Retrieve / RetrieveMultiple).

    1. Is this by CRM design by Microsoft? What is the sample code where I can fetch all rows even if the values are null?

    I'm asking this because I need to update those NULL values with valid data.

    2. Can I use Update service method if I already know the GUID value so I don't have to use Retrieve service method, or is this a must to use Retrieve first then Update? (I'm just looking at the sample code provided in SDK?

    3. Using ConditionExpression, what's the equivalent of LENGTH in condition operator? I need to check the column for a single character value, like '*', or '-'.

    Thank you very much for your help.

    Tuesday, April 1, 2014 7:39 AM

Answers

  • 1. Is this by CRM design by Microsoft? What is the sample code where I can fetch all rows even if the values are null?

    > Yes, this is by design you can only fetch column which have some values.

    I'm asking this because I need to update those NULL values with valid data.

    2. Can I use Update service method if I already know the GUID value so I don't have to use Retrieve service method, or is this a must to use Retrieve first then Update? (I'm just looking at the sample code provided in SDK?

    > If you have your guid, you don't need to write additional retrieve call.

    3. Using ConditionExpression, what's the equivalent of LENGTH in condition operator? I need to check the column for a single character value, like '*', or '-'.

    You can use equal operator if possible otherwise bring column and then validate their length.


    Our Website | Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    • Proposed as answer by HIMBAPModerator Tuesday, April 1, 2014 8:03 AM
    • Marked as answer by LayneDad Tuesday, April 1, 2014 9:24 AM
    Tuesday, April 1, 2014 8:03 AM
    Moderator

All replies

  • 1. Is this by CRM design by Microsoft? What is the sample code where I can fetch all rows even if the values are null?

    > Yes, this is by design you can only fetch column which have some values.

    I'm asking this because I need to update those NULL values with valid data.

    2. Can I use Update service method if I already know the GUID value so I don't have to use Retrieve service method, or is this a must to use Retrieve first then Update? (I'm just looking at the sample code provided in SDK?

    > If you have your guid, you don't need to write additional retrieve call.

    3. Using ConditionExpression, what's the equivalent of LENGTH in condition operator? I need to check the column for a single character value, like '*', or '-'.

    You can use equal operator if possible otherwise bring column and then validate their length.


    Our Website | Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    • Proposed as answer by HIMBAPModerator Tuesday, April 1, 2014 8:03 AM
    • Marked as answer by LayneDad Tuesday, April 1, 2014 9:24 AM
    Tuesday, April 1, 2014 8:03 AM
    Moderator
  • Thank you, Is there any documentation that I can read that states Microsoft opted to ignore columns with NULL values by design, so I can show my  team mates, they can't believe and says it makes no sense not showing fields with NULL values, I too believe that this is a very poor design by MS. No flexibility whatsoever! Thanks
    Tuesday, April 1, 2014 9:27 AM
  • Could you provide some information what is your requirement so that I will help you to look for workaround ?

    Our Website | Our Blog | Follow US | My Facebook Page | Microsoft Dynamics CRM 2011 Application Design
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Tuesday, April 1, 2014 1:17 PM
    Moderator
  • You could use Microsoft.Xrm.Client.Messages.RetrieveEntity to get all the fields for the entity and compare with the fields missing on the Entity record. If this is a relatively static sort of build you could generate and use Early Bound entities which would have all the fields even with null values. 

    I wouldn't say the excluding the Null fields is necessarily a poor design choice, especially for a web based service where shaving a few bytes of a packet can have an impact on performance. 

    Tuesday, April 1, 2014 4:25 PM
  • Hi LayneDad,

    You can retrieve Null Values also by using the Property called "GetAttributeValue";

    See here i am explaining one Example :- In the Contacts i have 2 records with firstname and lastname. Those are

    1. Firstname = Null  and Lastname = One

    2. Fistname = Null  and Lastname=Two

    Then i need to Retrieve these two Records from crm but if you use normal retrieve multiple query for this you will get error for this but if you use "GetAttributeValue" property then you will get Null Records also.

    Thank You.


    K V SambasivaRao

    Monday, April 14, 2014 11:41 AM