I created a dialog for getting data from the user. I want to access the user's responses from a plugin. I get the processsession entity in my plugin but there seems to be only metadata attached to it.
How can I get the user's responses from within the Plugin? Please note that I am using CRM online.
This link describes how to obtain the responses in the on-premise version. I cannot use that if I understood that correctly.
This article shows how to access comments from the dialogs but not the actual responses.
Here is what I did so far. The following code leads to the following output:
// we are in the plugin's execute method here
if (context.PostEntityImages.Contains("PostImage")
&& context.PostEntityImages["PostImage"].Attributes.Contains("comments"))
{
var postImage = (Entity)context.PostEntityImages["PostImage"];
if (postImage.Attributes.Contains("regardingobjectid"))
{
EntityReference regardingEntity = (EntityReference)postImage.Attributes["regardingobjectid"];
if (regardingEntity.LogicalName.Equals("contact"))
{
var DialogComments = (string)postImage.Attributes["comments"];
foreach (object o in postImage.Attributes)
{
trace(o.ToString());
}
}}}
The output is:
modifiedon, 9/10/2013 11:08:57 AM]
[statecode, Microsoft.Xrm.Sdk.OptionSetValue]
[regardingobjectid, Microsoft.Xrm.Sdk.EntityReference]
[startedby, Microsoft.Xrm.Sdk.EntityReference]
[createdon, 9/10/2013 11:08:47 AM]
[completedon, 9/10/2013 11:08:57 AM]
[completedby, Microsoft.Xrm.Sdk.EntityReference]
[processsessionid, ca15ec57-091a-e311-a88f-ac162dbe3218]
[ownerid, Microsoft.Xrm.Sdk.EntityReference]
[name, DialogSessionTest]
[statuscode, Microsoft.Xrm.Sdk.OptionSetValue]
[comments, eeeeeeeeeeeee]
[executedon, 9/10/2013 11:08:47 AM]
[modifiedby, Microsoft.Xrm.Sdk.EntityReference]
[owningbusinessunit, Microsoft.Xrm.Sdk.EntityReference]
[createdby, Microsoft.Xrm.Sdk.EntityReference]
[startedon, 9/10/2013 11:08:47 AM]
[processid, Microsoft.Xrm.Sdk.EntityReference]
[owninguser, Microsoft.Xrm.Sdk.EntityReference
I do not see any field to access the user's responses here. How can I access them?
Edit: I read here that I can use FetchXML to query the database in CRM online. Can I query views with that, too, or is it only for querying entities?
Thanks in advance and Cheers,
Arne
Here is the way I've used in recent project:
You can write all data in this entity including reference on record that initiate dialog (e.g. if dialog is for Contact: in "Look for:" select Contact in first field and Contact in second field - this will write EntityReference in the Look Up field).