plugin to set the values of dropdown in case form based on account lookup value RRS feed

  • Question

  • Hi,

    Here i want to know how to give relation between account and case form so that the values from account form can be displayed in case form respective to the account selected in the lookup value..

    Iam using this below code to fullfill the requirement as below...

    I have a requirement to write a plugin where..

    a)i have taken 2 dropdowns in case and same dropdowns in account form also.

    b)look up on case form with "account" as target

    c)if v select account 1 in account lookup field.. then the values of the dropdown fields of that respect account (i.e account 1) should be set automatically in case form dropdowns also.

    That means.. the values of account 1 dropdowns should be set in case form too.. and in the same way if i select account 2,3 etc, their respective dropdown values should be set in case form dropdowns

                if (context.InputParameters.Contains("Target") && context.InputParameters
    ["Target"] is Entity)
                    Entity entity = (Entity)context.InputParameters["Target"];
                    if (entity.LogicalName == "incident")
                        if (entity.Attributes.Contains("new_selectac"))
                            Guid AccountID = entity.GetAttributeValue<EntityReference>("new_selectac").Id;
                            Entity resultset = service.Retrieve("account", AccountID, new 
    ColumnSet(new String[] { "new_dropdown1", "new_dropdown2", "new_dropdown3" }));
                            EntityReference accountlookup = 
                                QueryExpression querybyexpression = new QueryExpression("account");     
                               querybyexpression.ColumnSet = new ColumnSet("new_dropdown1","new_dropdown2", "new_dropdown3");                           
    Friday, April 18, 2014 11:30 AM