Skip to content
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.

FetchXml StateCode Specified Cast is not Valid #612

Open
karthikChakravartula opened this issue Apr 12, 2024 · 0 comments
Open

FetchXml StateCode Specified Cast is not Valid #612

karthikChakravartula opened this issue Apr 12, 2024 · 0 comments
Labels

Comments

@karthikChakravartula
Copy link

karthikChakravartula commented Apr 12, 2024

We have a Custom Entity , we are using fetch Xml to retreive the Record.

When trying to Unit test the method it says Specified Cast is Not Valid when using retreive multiple.

We did generate Early bound Classes as Well.

Not sure what was missing.

Here is the Code below.

_context.EnableProxyTypes(Assembly.GetExecutingAssembly());

var pluginContext = _context.GetDefaultPluginContext();

`_context.Initialize(new List<Entity>() {
        _account,_envVariable
        });`

var fetchXml = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'> <entity name='envVariable'> <attribute name='key' /> <attribute name='value' /> <order attribute='key' descending='false' /> <filter type='and'> <condition attribute='statecode' operator='eq' value='0' /> <condition attribute='key' operator='eq' value='Event' /> </filter> </entity> </fetch>";

        `var rows = _context.GetOrganizationService().RetrieveMultiple(new FetchExpression(fetchXml));`

It is throwing specified error on retreive multiple.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant