Monday, September 18, 2017

RetrieveMultiple Using Newest Dynamics 365 SDK Gives Weird Behavior When Filtering on StateCode

Why in the world would it now be necessary to search using a conditionexpression on statecode by the strings "Active" or "Inactive"  instead of just taking the integer values of the optionset when performing a retrievemultiple request in a custom workflow activity.

 if (targetChildStateCode == 0)
                    strTargetChildStateCode = "Active";
                else if (targetChildStateCode == 1)
                    strTargetChildStateCode = "Inactive";
                int targetChildStatusReason = TargetChildStatusReason.Get(activityContext);
                tracingService.Trace("targetChildStateCode: " + targetChildStateCode.ToString());
                tracingService.Trace("targetChildStatusReason: " + targetChildStatusReason.ToString());
                tracingService.Trace("got parameters");
                tracingService.Trace("defined criteria and paging info");
                RetrieveMultipleRequest rmr = new RetrieveMultipleRequest();
                RetrieveMultipleResponse resp = new RetrieveMultipleResponse();
                QueryExpression query = new QueryExpression()
                    EntityName = childEntityName,
                    ColumnSet = new ColumnSet(true),
                    Criteria = new FilterExpression
                        FilterOperator = LogicalOperator.And,
                        Conditions =
                            new ConditionExpression
                                AttributeName = childLookupAttributeToParent,
                                Operator = ConditionOperator.Equal,
                                Values = { primaryEntityId.ToString() }
                            new ConditionExpression
                                AttributeName = "statecode",
                                Operator = ConditionOperator.NotEqual,
                                Values = { strTargetChildStateCode }

-head scratcher....


  1. Good Post. Avail Microsoft Dynamics Web Development Service that transform your business with customized business solutions.

  2. Interesting solution. I recently introduced an ERP system in my company and I am very satisfied! I would never have thought that it could be so useful :)
    Now I am thinking about the next solution. I want to bet on cloud solutions.
    I've read a lot about it and I think it can be a great topic. What do you think about it? I even found a company that specializes in it - this .
    I am happy to hear more from you about it - if you had to deal with it :)

  3. Wow that was odd. I just wrote an very long comment but after I clicked submit my comment didn’t appear. Grrrr… well I’m not writing all that over again. Anyways, just wanted to say fantastic blog!
    saas organization

  4. Certainly agree with just what you said. Your explanation was certainly the simplest to comprehend. I tell you, I usually get annoyed any time folks discuss issues that these people obviously dont know about. You were able to hit the nail on the head and spelled out the whole thing with out complication. Perhaps, folks could take a signal. Will likely be back to obtain more. Appreciate it

    Local IT Consultant | Refreshing Technology

  5. hey I'm not able subscribing to your RSS feed. Can you help or do you know why? thanks for the assistance.
    Thank you, Ive recently been looking for information about this subject matter for ages and yours is the best Ive found so far.

    Free Download PUBG


  6. Awesome post.
    Very good post.
    Always have to post a comment, I cant help it ! Thanks Sarah
    Web Design and Development

  7. up for this post!
    rosemond mesa subsoil stevo ayse haefelin Keri juli safebreaker
    ondrea encompass toils airy stranded arne rode washburne Arlee
    You are not the average blog writer, man. You certainly have something powerful to contribute to the World Wide Web. Such a outstanding blog. Ill come back again for more.

  8. Im going nuts this evening.
    So, whats bad respecting ?

  9. Hi.
    It's wonderful to hear that you are highly satisfied with the results! It's amazing how unexpectedly beneficial such a system can be, exceeding your initial expectations. Here is sharing some Data Modeling Training information may be its helpful to you.
    Data Modeling Training

  10. Great Informative Post. Looking for information on cloud computing Visit:

  11. Internal HR departments must invest a lot of time and effort on traditional offline hiring, which takes away from their departments' primary strategic tasks. Businesses can streamline resource allocation and free up HR employees to focus on key projects that promote organizational performance by outsourcing recruitment-related tasks. In addition to increasing productivity, this optimal resource allocation gives HR professionals the ability to strategically contribute to the broader goals of the business. You can view it now by clicking this link!