locked
Default Value in lookup RRS feed

  • Question

  •  

    We have Project & Supervisor(User) Lookup fields added on "CustomActivity" form. What we have to do is


    1. User must select Project from "Project " Lookup field.
    2. Based on the Project selection "Supervisor" (related to selected Project) should be selected automatically in "Supervisor" lookup field. 

     

    Can anyone guide while each project has just one supervisor.

    Wednesday, June 4, 2008 7:20 AM

Answers

  • No its not working, below is code but doesnt show me filtered records

     

    var Supervisor = "domain\abc";

    var entityForList = "user";
    var attribForFilter = "domainname";
    var idToFetch =Supervisor;
    var fetchStr= "<fetch mapping= 'logical'>" +
    "<entity name='" + entityForList + "'>" +
    "<all-attributes />" +
    "<filter>" +
    "<condition attribute='" + attribForFilter + "' operator='eq' value='"+ idToFetch + "' />" +
    " </filter>" +
    " </entity>" +
    "</fetch>";
    crmForm.all.new_Supervisor.lookupbrowse = 1;
    crmForm.all.new_Supervisor.additionalparams= "search=" + fetchStr;
    crmForm.all.new_Supervisor.setAttribute("readonly",false);

     

    Wednesday, June 4, 2008 9:00 AM

All replies

  • Hi Nazish,

     

    I think you can do it using javascript.

     

    Use fetchxml to retrieve corresponding supervisor and  populate lookup with it.

     

    I m not sure about this aproach.

     

    Regards

     

    Renis

     

    Wednesday, June 4, 2008 8:33 AM
  • No its not working, below is code but doesnt show me filtered records

     

    var Supervisor = "domain\abc";

    var entityForList = "user";
    var attribForFilter = "domainname";
    var idToFetch =Supervisor;
    var fetchStr= "<fetch mapping= 'logical'>" +
    "<entity name='" + entityForList + "'>" +
    "<all-attributes />" +
    "<filter>" +
    "<condition attribute='" + attribForFilter + "' operator='eq' value='"+ idToFetch + "' />" +
    " </filter>" +
    " </entity>" +
    "</fetch>";
    crmForm.all.new_Supervisor.lookupbrowse = 1;
    crmForm.all.new_Supervisor.additionalparams= "search=" + fetchStr;
    crmForm.all.new_Supervisor.setAttribute("readonly",false);

     

    Wednesday, June 4, 2008 9:00 AM
  • Have a look the The mysterious CRM Lookup

     

    Jim

    Wednesday, June 4, 2008 3:08 PM
    Moderator
  • How can I set the lookup first value as defualt lookup field value?
    Thursday, June 5, 2008 7:26 AM