locked
Null value in Regarding lookup for an activity RRS feed

  • Question

  • Hello,

    In CRM 2011, Case entity I have added a grid in the form to add the list of tasks related to the respective Case. When clicking on Add New Task in the grid (ribbon), a new Task form opens with regarding field auto filled with the respective Case. But, the Case value in the lookup is showing null rather showing the Case Name. However, when opened the Case from the lookup, it is redirecting to the correct Case. After creating the case, it is showing the proper Case Name.

    I am looking for the answers to below queries:

    1) Why Regarding lookup is showing Null value rather than showing CaseName? How can I show up the Case Name when a new form is opened from the grid?

    2) When tried to create the Task from the left navigation Activities in the Case record, it worked properly showing the Case Name in the regarding field  in the new form. Why is the issue only in the Grid?

    3) What are the possibilities for this issue?

    Any help is highly appreciated. 

    Thanks,

    Sri

      

    Wednesday, December 10, 2014 2:25 AM

Answers

  • Hi Folks,

    I got the resolution for this issue.

    Cause for the issue: The title of the Case which will be displayed in the regarding look up of Task is not available on the Case form.

    So, by adding the Title field in the Case form, the issue was resolved.

    Thanks,

    Sri.

    • Marked as answer by K_Srinivas Wednesday, December 10, 2014 5:48 AM
    Wednesday, December 10, 2014 5:22 AM

All replies

  • Hi Sri,

    This is the out of the box behavior in CRM. What you can do is you can write a javascript on the form load of task to populate the Regarding field.

    something similar to this:

    function SetRegardingCase()
    {
        //debugger;
        var parentRecordID = GetUrl();
        caseId = parentRecordID .substring(3, parentRecordID .length - 3);
    
        function GetUrl() {
            var id = ""
            var name = "_CreateFromId";
    
            name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
            var regexS = "[\\?&]" + name + "=([^&#]*)";
            var regex = new RegExp(regexS);
            var results = regex.exec(window.location.href);
    
            if (results == null) {
    
            } else {
                id = results[1];
            }
            return id;
        }
    
        if (caseId != null) {
            var lookup = new Array();
            lookup[0] = new Object();
            lookup[0].id = parentRecordID;
            lookup[0].name = //get the name of the case by a odata query
            lookup[0].entityType = 'incident';
            Xrm.Page.getAttribute("regardingobjectid").setValue(lookup);
        }
    }

    Thanks

    Sachith


    Sachith Chandrasiri

    Wednesday, December 10, 2014 5:01 AM
  • Hi Folks,

    I got the resolution for this issue.

    Cause for the issue: The title of the Case which will be displayed in the regarding look up of Task is not available on the Case form.

    So, by adding the Title field in the Case form, the issue was resolved.

    Thanks,

    Sri.

    • Marked as answer by K_Srinivas Wednesday, December 10, 2014 5:48 AM
    Wednesday, December 10, 2014 5:22 AM