I have one ribbon button.On click of that ribbon button I want to open form of some related entity in print preview mode.If we examine the url of a form in print preview there is a parameter known as form id. I don't want to hard code as it will change in production and test environments.
I tried the following message:
RetrieveFilteredFormsRequest req = new RetrieveFilteredFormsRequest();
req.EntityLogicalName = "contact";
req.FormType = new OptionSetValue(4);
req.SystemUserId = new Guid("81CB7A6D-E57F-E211-B4F7-78E3B51196DB");
RetrieveFilteredFormsResponse resp = (RetrieveFilteredFormsResponse)slos.Execute(req);
It does not give any result for option set value 4(print preview).However it returns results for option set value 2(Main).Same is the case with below query:
QueryExpression query = new QueryExpression();query.EntityName = SystemForm.EntityLogicalName;
ConditionExpression cnd1 = new ConditionExpression();
cnd1.AttributeName = "type";
cnd1.Operator = ConditionOperator.Equal;
cnd1.Values.Add(4);
ConditionExpression cnd2 = new ConditionExpression();
cnd2.AttributeName = "objecttypecode";
cnd2.Operator = ConditionOperator.Equal;
cnd2.Values.Add("rus_factfinder");
FilterExpression filter = new FilterExpression();
filter.AddCondition(cnd1);
filter.AddCondition(cnd2);
filter.FilterOperator = LogicalOperator.And;
query.Criteria.AddFilter(filter);
EntityCollection coll = slos.RetrieveMultiple(query);
If any query works in c# we could use soap logger to get request and response soap message and accordingly parse the response to get the form id or there might be some other alternative way....please help me through this.