locked
CRM 4 - Differentiate Phone Calls & Followup Calls RRS feed

  • Question

  • Is there any way to find the followup calls alone from the phone call list? Also, is there any way to list one phone call at a time and it's followup calls alone?
    Tuesday, March 25, 2008 10:16 AM

Answers

  • Hi.

     

    You need to mark the new bit attribute using a pre create plug-in unless you want to rely on users opening the follow-up activity.

     

    The way to do that is to hook to the client side function that creates the follow-up and add some sort of marking to the subject field e.g. Bla Bla Bla <Follow-up>

    Before the form is saved delete the <Follow-up> marking and set the bit field.

     

    In order to display the activity and related follow-ups you need to do 2 things:

    1. Create another attribute (new_parentactivity) to hold the parent activity GUID.

        You can update this field in the pre create plug-in above.

    2. Create a custom view with a pre-defined fetch inside an iframe.

        Follow this link for more information -

        http://forums.microsoft.com/Dynamics/ShowPost.aspx?PostID=3052005&SiteID=27

     

    Cheers,

    Adi

     

    Tuesday, March 25, 2008 4:53 PM

All replies

  • There is no standard way to distinguish between a call created as part of a followup, or one created 'normally' in CRM. However, you could try the following:

    1. Create a new boolean (bit) attribute on the phonecall entity called, say, followupcall, and give it a default value of true
    2. Add the new attribute to the phonecall form, and add some client script to the phonecall form's onload event to set this attribute to false if the FormType property is Create or QuickCreate (see the CRM SDK for more information on this)
    Tuesday, March 25, 2008 1:26 PM
    Moderator
  • Hi.

     

    You need to mark the new bit attribute using a pre create plug-in unless you want to rely on users opening the follow-up activity.

     

    The way to do that is to hook to the client side function that creates the follow-up and add some sort of marking to the subject field e.g. Bla Bla Bla <Follow-up>

    Before the form is saved delete the <Follow-up> marking and set the bit field.

     

    In order to display the activity and related follow-ups you need to do 2 things:

    1. Create another attribute (new_parentactivity) to hold the parent activity GUID.

        You can update this field in the pre create plug-in above.

    2. Create a custom view with a pre-defined fetch inside an iframe.

        Follow this link for more information -

        http://forums.microsoft.com/Dynamics/ShowPost.aspx?PostID=3052005&SiteID=27

     

    Cheers,

    Adi

     

    Tuesday, March 25, 2008 4:53 PM
  • Hi Adi,

    The link you have posted is for CRM 3.0 right? How about 4.0?

    We tried to use the same code for CRM 4.0 but the link "/AdvancedFind/fetchData.aspx?EntityCode=4200&QueryId={00000000-0000-0000-00AA-000010001899}&ViewType=1039" is throwing CRM error message.
    Wednesday, March 26, 2008 7:20 AM
  • Hi.

     

    No, this a 4.0 working example.

    The url above is only a small part of the entire solution.

     

    Adi

     

    Wednesday, March 26, 2008 9:42 AM
  • Hi Adi,

    Oh... Thanks... We have created "CustomAdvFind.aspx" page as per your instructions in this link (http://forums.microsoft.com/Dynamics/ShowPost.aspx?PostID=3052005&SiteID=27). But when we run the "CustomAdvFind.aspx" in IE we got the CRM error... So, we tried calling the link "/AdvancedFind/fetchData.aspx?EntityCode=4200&QueryId={00000000-0000-0000-00AA-000010001899}&ViewType=1039", even this page throws CRM error... 

    We can understand that EntityCode 4200 refers to Activities, 00000000-0000-0000-00AA-000010001899 refers to "My Activities". Can you please explain about the ViewType value?
    Wednesday, March 26, 2008 10:26 AM
  • Hi.

     

    1. Open the advanced find > Ctrl + N

    2. Build your query or use a saved view > Run

    3. Enter the following script in the address bar:

     

    Code Snippet

     

    javascript:void( new function() { var s=""; function f(p){ s+= p + "=" + eval("advFind." + p) + "\n\n" };f("FetchXml");f("LayoutXml");f("EntityName");f("QueryId");f("QueryObjectType");alert(s) } )

     

     

     

    4. Focus the alert > Ctrl + A > Ctrl + C > Paste in notepad.

     

    Notes:

    The SortCol is the name of your primay sort column

    The SortDescend is of type boolean = "true" or "false";

    QueryObjectType Parameter is ViewType

     

    5. Assign the CustomAdvFind.aspx with these values.

     

    Cheers,

    Adi

     

     

    Wednesday, March 26, 2008 11:45 AM
  • Thanks a lot Legend Adi... Trying now... Smile
    Wednesday, March 26, 2008 12:02 PM
  • Hi Adi,

    Still we are having problems with the "CustomAdvFind.aspx".... Can you please look into same and let us know the corrections.

    <html xmlns="http://www.w3.org/1999/xhtml" >

    <head runat="server">
    <script runat="server">

    string FetchXml = string.Empty;
    string LayoutXml = string.Empty;
    string EntityName = string.Empty;
    string SortCol = string.Empty;
    string SortDescend = string.Empty;
    string EntityCode = string.Empty;
    string QueryId = string.Empty;
    string ViewType = string.Empty;

    private void Page_Load( object sender , EventArgs e )
    {
    switch( Request["fetchid"] )
    {

    //Usage Example
    case "1":
    FetchXml = @"<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false"><entity name="phonecall"><attribute name="subject"/><attribute name="regardingobjectid"/><attribute name="scheduledend"/><attribute name="scheduledstart"/><attribute name="new_callstatus"/><attribute name="activityid"/><order attribute="scheduledend" descending="true"/><filter type="and"><condition attribute="regardingobjectid" operator="eq" uiname="ABC Web Services" uitype="account" value="{F65762B0-65F2-DC11-9260-0003FF69D9A1}"/></filter></entity></fetch>";

    LayoutXml = @"<grid name="resultset" object="4210" jump="subject" select="1" preview="1" icon="1"><row name="result" id="activityid"><cell name="regardingobjectid" width="150"/><cell name="scheduledstart" width="100"/><cell name="new_callstatus" width="100"/><cell name="subject" width="250"/><cell name="scheduledend" width="100"/></row></grid>";

    EntityName = "phonecall";
    EntityCode = "4210";
    QueryId = "{C52D375C-2FFB-DC11-8A7F-0003FF69D9A1}";
    ViewType = "4230";
    SortCol = "scheduledend";
    SortDescend = "true";
    break;
    }
    }
    </script>

    <script language="javascript">
    debugger;
    function OnCustomGridReady()
    {
    if( document.all.resultFrame.readyState != 'complete' )
    return;

    resultFrame.document.body.style.padding = "0px";
    }
    </script>
    </head>

    <body topmargin="0" leftmargin="0" scroll="no" onload="resultRender.submit();">

    <FORM id="resultRender"
    action="/AdvancedFind/fetchData.aspx?EntityCode=<%=EntityCode%>&QueryId=<%=QueryId%>&ViewType=<%=ViewType%>"
    method="post"
    target="resultFrame">

    <INPUT type="hidden" name="FetchXml" value="<%=FetchXml%>">
    <INPUT type="hidden" name="LayoutXml" value="<%=LayoutXml%>">
    <INPUT type="hidden" name="EntityName" value="<%=EntityName%>">
    <INPUT type="hidden" name="DefaultAdvFindViewId" value="<%=QueryId%>">
    <INPUT type="hidden" name="ViewId" value="<%=QueryId%>">
    <INPUT type="hidden" name="ViewType" value="<%=ViewType%>">
    <INPUT type="hidden" name="SortCol" value="<%=SortCol%>">
    <INPUT type="hidden" name="SortDescend" value="<%=SortDescend%>">
    </FORM>


    <iframe id="resultFrame"
    name="resultFrame"
    src="/_root/Blank.aspx"
    onreadystatechange="OnCustomGridReady();"
    width="100%"
    height="100%"
    scrolling="no"></iframe>

    </body>
    </html>

    Running this page throws CRM error...
    Wednesday, March 26, 2008 12:35 PM
  • Hi

     

    Replace the Fetchxml and LayoutXml xml Attribute Delimiter from ( " ) to -> ( ' ) or ( "" )

    for example:

     

    FetchXml = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'><entity name='phonecall'><attribute name='subject'/><attribute name='regardingobjectid'/><attribute name='scheduledend'/><attribute name='scheduledstart'/><attribute name='new_callstatus'/><attribute name='activityid'/><order attribute='scheduledend' descending='true'/><filter type='and'><condition attribute='regardingobjectid' operator='eq' uiname='ABC Web Services' uitype='account' value='{F65762B0-65F2-DC11-9260-0003FF69D9A1}'/></filter></entity></fetch>";

     

    OR

     

    FetchXml = @"<fetch version=""1.0"" output-format=""xml-platform"" mapping=""logical"" distinct=""false""><entity name=""phonecall""><attribute name=""subject""/><attribute name=""regardingobjectid""/><attribute name=""scheduledend""/><attribute name=""scheduledstart""/><attribute name=""new_callstatus""/><attribute name=""activityid""/><order attribute=""scheduledend"" descending=""true""/><filter type=""and""><condition attribute=""regardingobjectid"" operator=""eq"" uiname=""ABC Web Services"" uitype=""account"" value=""{F65762B0-65F2-DC11-9260-0003FF69D9A1}""/></filter></entity></fetch>";

    Why do you need the <HTML Tag as runat=server ?

     

    This FetchXml is static, Consider concatenating Querystring Parameters passed from the caller into the fetch <condition node. You may also delete the uiname attribute.

     

    This should work.

     

    Cheers,

    Adi

     

    Wednesday, March 26, 2008 1:11 PM
  • Sorry Adi... Looks I am disturbing you alot... Will try as per your sugession and let you know how it went... Smile
    Wednesday, March 26, 2008 1:39 PM
  • Hi Adi,

    Sorry again... Getting "Access is denied." in the line "resultFrame.document.body.style.padding = "0px";"... If I press the continue button, I am getting the CRM message "Record is Unavailable"... When I check the saved view from view editor window it's working fine.

    The view is custom saved "phonecall" view. We have just added a new filter condition to filter the records based on regardingobject id... To create this view we used existing view "All Phone Calls" and then added "Regarding Euqals xxx" and saved that view as "All Phone Calls Based on Account".

    Please let me know if I need to explain something other settings in our CRM 4 system.
    Wednesday, March 26, 2008 1:55 PM
  • Hi.

     

    Post the entire code, the CustomAdvFind.aspx and the calling Javascript.

    It will be easier to debug.

     

    Adi

     

    Wednesday, March 26, 2008 2:23 PM
  • Hi Adi,

    Here is the code... Tried calling this page straight away from browser and in CRM-IFrame too... But getting CRM error message "Record is Un Available"... Have'nt change the regarding "value" as to make sure that it's working before changing the values dynamically.

    <html xmlns="http://www.w3.org/1999/xhtml" >

    <head runat="server">
    <script runat="server">

    string FetchXml = string.Empty;
    string LayoutXml = string.Empty;
    string EntityName = string.Empty;
    string SortCol = string.Empty;
    string SortDescend = string.Empty;
    string EntityCode = string.Empty;
    string QueryId = string.Empty;
    string ViewType = string.Empty;

    private void Page_Load( object sender , EventArgs e )
    {
    switch( Request["fetchid"] )
    {

    //Usage Example
    case "1":
    FetchXml = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
    <entity name='phonecall'>
    <attribute name='subject'/>
    <attribute name='regardingobjectid'/>
    <attribute name='scheduledend'/>
    <attribute name='scheduledstart'/>
    <attribute name='new_callstatus'/>
    <attribute name='activityid'/>
    <order attribute='scheduledend' descending='true'/>
    <filter type='and'>
    <condition attribute='regardingobjectid' operator='eq' uitype='account' value='{F65762B0-65F2-DC11-9260-0003FF69D9A1}'/>
    </filter>
    </entity>
    </fetch>";

    LayoutXml = @"<grid name='resultset' object='4210' jump='subject' select='1' preview='1' icon='1'>
    <row name='result' id='activityid'>
    <cell name='regardingobjectid' width='150'/>
    <cell name='scheduledstart' width='100'/>
    <cell name='new_callstatus' width='100'/>
    <cell name='subject' width='250'/>
    <cell name='scheduledend' width='100'/>
    </row>
    </grid>";

    EntityName = "phonecall";
    EntityCode = "4210";
    QueryId = "{C52D375C-2FFB-DC11-8A7F-0003FF69D9A1}";
    ViewType = "4230";
    SortCol = "scheduledend";
    SortDescend = "true";
    break;
    }
    }
    </script>

    <script language="javascript">
    function OnCustomGridReady()
    {
    if( document.all.resultFrame.readyState != 'complete' )
    return;

    resultFrame.document.body.style.padding = "0px";
    }
    </script>
    </head>

    <body topmargin="0" leftmargin="0" scroll="no" onload="resultRender.submit();">

    <FORM id="resultRender"
    action="/AdvancedFind/fetchData.aspx?EntityCode=<%=EntityCode%>&QueryId=<%=QueryId%>&ViewType=<%=ViewType%>"
    method="post"
    target="resultFrame">

    <INPUT type="hidden" name="FetchXml" value="<%=FetchXml%>">
    <INPUT type="hidden" name="LayoutXml" value="<%=LayoutXml%>">
    <INPUT type="hidden" name="EntityName" value="<%=EntityName%>">
    <INPUT type="hidden" name="DefaultAdvFindViewId" value="<%=QueryId%>">
    <INPUT type="hidden" name="ViewId" value="<%=QueryId%>">
    <INPUT type="hidden" name="ViewType" value="<%=ViewType%>">
    <INPUT type="hidden" name="SortCol" value="<%=SortCol%>">
    <INPUT type="hidden" name="SortDescend" value="<%=SortDescend%>">
    </FORM>


    <iframe id="resultFrame"
    name="resultFrame"
    src="/_root/Blank.aspx"
    onreadystatechange="OnCustomGridReady();"
    width="100%"
    height="100%"
    scrolling="no"></iframe>

    </body>
    </html>
    Wednesday, March 26, 2008 2:47 PM
  •  

    Hi.

     

    Replace <head runat="server"> with <head>

    If you need the <head> to be a server control put the <script runat="server" before the <html tag.

     

    Other then that, the rest looks ok.

     

    The error indicates a missing instance <record>. You have 2 GUIDS on the page, the first is the account being fetched and the other it the QueryId. There is a change that one of them is not valid.

     

    <IFRAME src should be src="/[OrgName]/_root/Blank.aspx"OR "about:blank"

     

    Can't see any other reason for this not to work.

     

    Also you say that you're using a saved view, do you intend to share this view?

    if not then don't use it QueryId, Use the default advanced find QueryId.

     

    Cheers,

    Adi

     

     

     

    Wednesday, March 26, 2008 4:38 PM
  • Hi Adi,

    Working greate Now!!!!!!!!!! Thanks a lot...

    How to set the "count" (to restrict records display in the view) in FetchXML... We tried all the possible ways but not able to limit the records... What should be the Minimum value that can be assigned?
    Wednesday, March 26, 2008 5:40 PM
  • hi ajai,

     i am also getting the same CRM error when i run the aspx code in the browser. can you pls provide me the steps which you followed in order to display the custom advanced find view in Iframe.

     

    thanks

    Chris

     

    Thursday, March 27, 2008 8:53 AM
  • Hi Chris,

    Just follow last 3 post steps you should be able to run the page... Also instead of running it inside IFrame try that straight away in browser too....

    Best of luck.
    Thursday, March 27, 2008 10:02 AM
  • hi ajai,

     when i try to run the customadvfind.aspx page inside the browser. i am getting an "CRM error" pop up message in the browser. on clicking the try again button i am getting an ' Access Denied' script error. Can you pls help me out in solving this.

     

    Thanks

    Chris

     

    Thursday, March 27, 2008 10:12 AM
  • hi ajai,

     did you created the virtual directory for the customadvfind.aspx application inside CRM application web site or under default website. can you pls tell me.

     

    thanks

    Chris

     

     

    Thursday, March 27, 2008 11:15 AM
  • Hi Chris,

    You can just create an folder inside the CRM site and add the following line in web.config file of your folder.

    <system.web>
    <httpModules>
    <clear />
    </httpModules>
    </system.web>
    Thursday, March 27, 2008 4:47 PM
  • hi ajai,

      I added the above mentioned code in web.config file of my customadvfind.aspx page and tried executing the application in browser, its giving CRM errror popup. the url which i am used in the <form> tag of my customadvfind.aspx page is as follows

    <FORM id="resultRender"
    action="http://CRM:5555/AdvancedFind/fetchData.aspx?EntityCode=<%=EntityCode%>&QueryId=<%=QueryId%>&ViewType=<%=ViewType%>"
    method="post"
    target="resultFrame">

    if i change the <form> tag with the below mentioned code, i am getting the main screen of advanced find view with 'Access Denied' script error.

      <FORM id="resultRender"
    action="http://CRM:5555/AdvancedFind/AdvFind.aspx?EntityCode=<%=EntityCode%>&QueryId=<%=QueryId%>&ViewType=<%=ViewType%>"
    method="post"
    target="resultFrame">

     

     Can you pls tell me the sequence of steps which you followed in order achieve this task.

     

    thanks

    Chris

    Friday, March 28, 2008 5:10 AM
  • Hi Chris

    This is the code we have here and which is running fine....

    Code Snippet

    <html xmlns="http://www.w3.org/1999/xhtml" >


    <head>
    <script runat="server">

    string FetchXml = string.Empty;
    string LayoutXml = string.Empty;
    string EntityName = string.Empty;
    string SortCol = string.Empty;
    string SortDescend = string.Empty;
    string EntityCode = string.Empty;
    string QueryId = string.Empty;
    string ViewType = string.Empty;

    private void Page_Load( object sender , EventArgs e )
    {
        switch( Request["fetchid"] )
        {
            case "1":
                FetchXml = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
                        <entity name='phonecall'>
                            <attribute name='subject'/>
                            <attribute name='regardingobjectid'/>
                            <attribute name='scheduledend'/>
                            <attribute name='scheduledstart'/>
                            <attribute name='activityid'/>
                            <order attribute='scheduledend' descending='true'/>
                            <filter type='and'>
                                <condition attribute='regardingobjectid' operator='eq' uitype='account' value='{F65762B0-65F2-DC11-9260-0003FF69D9A1}'/>
                            </filter>
                        </entity>
                    </fetch>";

                LayoutXml = @"<grid name='resultset' object='4210' jump='subject' select='1' preview='1' icon='1'>
                        <row name='result' id='activityid'>
                            <cell name='regardingobjectid' width='150'/>
                            <cell name='scheduledstart' width='100'/>
                            <cell name='subject' width='250'/>
                            <cell name='scheduledend' width='100'/>
                        </row>
                    </grid>";

                EntityName = "phonecall";
                EntityCode = "4210";
                QueryId = "{C52D375C-2FFB-DC11-8A7F-0003FF69D9A1}";
                ViewType = "4230";
                SortCol = "scheduledend";
                SortDescend = "true";
            break;
        }
    }
    </script>

    <script language="javascript">
    function OnCustomGridReady()
    {
        if( document.all.resultFrame.readyState != 'complete' )
            return;

        resultFrame.document.body.style.padding = "0px";
    }
    </script>
    </head>

    <body topmargin="0" leftmargin="0" scroll="no" onload="resultRender.submit();">

    <FORM id="resultRender"
        action="/AdvancedFind/fetchData.aspx?EntityCode=<%=EntityCode%>&QueryId=<%=QueryId%>&ViewType=<%=ViewType%>"
        method="post"
        target="resultFrame">

    <INPUT type="hidden" name="FetchXml" value="<%=FetchXml%>">
    <INPUT type="hidden" name="LayoutXml" value="<%=LayoutXml%>">
    <INPUT type="hidden" name="EntityName" value="<%=EntityName%>">
    <INPUT type="hidden" name="DefaultAdvFindViewId" value="<%=QueryId%>">
    <INPUT type="hidden" name="ViewId" value="<%=QueryId%>">
    <INPUT type="hidden" name="ViewType" value="<%=ViewType%>">
    <INPUT type="hidden" name="SortCol" value="<%=SortCol%>">
    <INPUT type="hidden" name="SortDescend" value="<%=SortDescend%>">
    </FORM>


    <iframe id="resultFrame"
        name="resultFrame"
        src="/_root/Blank.aspx"
        onreadystatechange="OnCustomGridReady();"
        width="100%"
        height="100%"
        scrolling="no">
    </iframe>

    </body>
    </html>



    Please make sure to replace this value "{F65762B0-65F2-DC11-9260-0003FF69D9A1}" with your account id. You have to call this page along with querystring "fetchid=1"...

    Regarding the access denied error, I can think of few things
    Code Snippet

    1. Make sure that your web.config looks something similar to below one
    <?xml version="1.0"?>
    <configuration>
        <appSettings/>
        <connectionStrings/>
        <system.web>
            <compilation debug="true" urlLinePragmas="true">
            </compilation>
            <customErrors mode="Off" />
            <httpModules>
                <clear />
            </httpModules>
        </system.web>
        <system.codedom>
        </system.codedom>
        <system.webServer>
        </system.webServer>
    </configuration>



    2. Make sure that you have not enabled the "Anonymous" authentication for the website also Integrated windows authentication is enabled in the IIS.

    3. Make sure that you have logged in to the domain (which has ADS)

    4. Make sure that the domain & system users like "System", "IIS_WPG", "Administrators", "Users" have proper rights for your folder.

    5. Make sure that IUSR_<System Name> is not in the users list.

    6. Make sure that your IE setting "Enable Windows Integrated Authentication" has been enabled.

    Best of luck.

    Friday, March 28, 2008 10:30 AM
  • thanks for help... the code is working now..

    Friday, March 28, 2008 1:16 PM
  • Happy to hear that  it's working  now Smile You are always welcome...
    Friday, March 28, 2008 1:59 PM
  • The codes are great and I also got it working. But it is quite useless if we are going to hardcode the "value" inside the fetchxml string.

     

    Can you share with us how to pass a variable from the URL into the fetchxml string? I have tried below syntax but they don't work. I always get "invalid argument" or "compilation error". Thanks!

     

    Method 1

    string customguid = Request["URLvariable"];

    <filter type='and'>
    <condition attribute='regardingobjectid' operator='eq' uitype='account' value='"+customguid+"'/>
    </filter>

     

    Method 2

    <filter type='and'>
    <condition attribute='regardingobjectid' operator='eq' uitype='account' value='"+Request["URLvariable"]+"'/>
    </filter>


     

    Thursday, May 1, 2008 10:54 AM
  • I finally got it working after modifying the FetchXML statement using a string variable to concatenate the variable and reassign it to FetchXML statement.


    string getfetchxmlstring = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>";
    ...
    ...
    ...
    getfetchxmlstring += "<filter type='and'><condition attribute='cust_subcategoryid' operator='eq' value='";
    getfetchxmlstring += customguid;
    getfetchxmlstring += "'/></filter></link-entity></link-entity></entity></fetch>";

    FetchXML = @getfetchxmlstring;

     

    Saturday, May 3, 2008 9:32 AM