locked
Error fetchXml from plugin RRS feed

  • Question

  • When I run this code:
    string fetch = @"
                    <fetch distinct='false' mapping='logical' > 
    	                <entity name='queueitem'> 
                            <attribute name='queueitemid'/>	
    		                <attribute name='objectid'/> 
    		                <attribute name='title'/> 
    		                <attribute name='enteredon'/> 
    		                <order descending='false' attribute='enteredon'/> 
    		                <link-entity name='queue' to='queueid' > 
                               <filter type='and'> 
                                    <condition attribute='name' value='Casi in attesa' operator='eq'/>
                               </filter> 
                            </link-entity>
                            <link-entity name='incident' to='objectid'>
                                <attribute name='subjectid'/>
                                <attribute name='ticketnumber'/>
                            </link-entity> 
    	                </entity>
                    </fetch>  ";
    
    
                    EntityCollection result = service.RetrieveMultiple(new FetchExpression(fetch));
    
                    foreach (Entity e in result.Entities)
                    {
                        string arg = e.Attributes["subjectid"].ToString();
    				}
    

    i receie error on 

    string arg = e.Attributes["subjectid"].ToString();

    The given key was not present in the dictionary. at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at ActivityAssegnaCasi.assegnaCasi.Execute(CodeActivityContext executionContext) at ActivityAssegnaCasi.assegnaCasi.Execute(CodeActivityContext executionContext) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation) Why?

    Wednesday, October 19, 2011 3:01 PM

Answers

  • Hi,

    It help you:

    string fetch = @"
                    <fetch distinct='false' mapping='logical' > 
    	                <entity name='queueitem'> 
                            <attribute name='queueitemid'/>	
    		                <attribute name='objectid'/> 
    		                <attribute name='title'/> 
    		                <attribute name='enteredon'/> 
    		                <order descending='false' attribute='enteredon'/> 
    		                <link-entity name='queue' to='queueid'> 
                               <filter type='and'> 
                                    <condition attribute='name' value='Casi in attesa' operator='eq'/>
                               </filter> 
                            </link-entity>
                            <link-entity name='incident' to='objectid' alias='incident_class'>
                                <attribute name='subjectid'/>
                                <attribute name='ticketnumber'/>
                            </link-entity> 
    	                </entity>
                    </fetch>  ";
    
    
                    EntityCollection result = service.RetrieveMultiple(new FetchExpression(fetch));
    
                    foreach (Entity e in result.Entities)
                    {
                        string arg = e.Attributes["incident_class.subjectid"].ToString();
    				}


    • Marked as answer by foffolo Wednesday, October 19, 2011 3:28 PM
    Wednesday, October 19, 2011 3:05 PM