Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Error - Post retrieve savedquery

$
0
0

Hi,

I have made a synchronous plugin registered on Post retrieve of savedquery.

So I want to modify the fetchxml and the layoutxml of a view.

The update of the fetchxml works well, not the layout.

the new layout throw an error:

Here is the code below:

var output = esp.GetOutputParameter<Entity>("BusinessEntity");
 QueryExpression qenew = new QueryExpression("sqli_opportunityroadmap");
            qenew.ColumnSet.AddColumns("sqli_annee");
            qenew.LinkEntities.Add(new LinkEntity("sqli_opportunityroadmap", "opportunity", "sqli_opportunitid", "opportunityid", JoinOperator.LeftOuter));
            qenew.LinkEntities[0].Columns.AddColumns("sqli_num_chrono", "parentaccountid", "sqli_roadmap");
            qenew.LinkEntities[0].EntityAlias = "roadmap";
            qenew.LinkEntities[0].LinkCriteria.Filters.Add(
                   new FilterExpression()
                   {
                       FilterOperator = LogicalOperator.And,
                       Conditions =
                       {
                           new ConditionExpression("estimatedclosedate", ConditionOperator.NextXMonths, 3),
                       }
                   }
               );
            QueryExpressionToFetchXmlRequest req = new QueryExpressionToFetchXmlRequest();
            req.Query = qenew;
            QueryExpressionToFetchXmlResponse resp = (QueryExpressionToFetchXmlResponse)AdminService.Execute(req);

            string myfetch = resp.FetchXml;
 System.String layout = @"< grid name ='resultset' icon='1' preview='1' select='1' jump='sqli_name' object='10074'>
                          < row id ='sqli_opportunityroadmapid' name='result'>                              
                                 </row>
                                </ grid > ";
            output["layoutxml"] = layout; // if I comment this line, the view is correctly displayed with default layout.
            output["fetchxml"] = myfetch;


Thank you.

Saad


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>