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....

11 comments:

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

    ReplyDelete
  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 :)

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete
  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

    ReplyDelete

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

    ReplyDelete
  7. Avail this bargaining tool in your e-commerce storebargainingtool

    ReplyDelete
  8. 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.
    RCG ONLINE STORE

    ReplyDelete
  9. Im going nuts this evening.
    So, whats bad respecting ?
    ALL ABOUT SEO

    ReplyDelete
  10. Olansi luftreiniger - China hepa uvc luftreiniger home luftreiniger hersteller

    Olansi, bester Luftreiniger Hersteller in China, Haushalt, Raum- und Raum-Luftreiniger Fabrik, Luftreiniger für Home, UVC-Luftreiniger Covid, HEPA-Luftreiniger, 15+ Jahre OEM / ODM-Erfahrung.
    Olansi is a professional manufacturer of air purifier, hydrogen water, water purifier, etc. healthcare products, more than 11 years experience since 2006 in Guangzhou, China. We are prfessional in ODM, OEM services! 3,000 PCs per day of production capacity! 100% aging test for mass production! CE, CB, ROHS, SASO, CQC, CCC approval and ISO 9001: 2008 certificate!

    EMail : daniel@olansgz.com

    Website : https://www.olanside.com/

    Call : 0086-15915736889

    Address : Building 1, No.1 of Haiyi Road, Lanhe City, Nansha District, Guangzhou, China
    place

    ReplyDelete