Default vaue in lookup fild ;;(concerns Microsoft CRM)

thanasisthanasis Member Posts: 5
edited 2006-08-21 in Dynamics CRM
i already know that in this version of CRM you can't create a lookup field...

although my question is how to put a default value (for example a customer's or account's code) in a lookup field ???

Comments

  • sandra.pralongsandra.pralong Member Posts: 1
    You can do it in the onLoad event from the form of the entity.

    The code looks like :

    var oField = crmForm.all.subjectid;
    var lookupItem = new Array();

    if (oField.DataValue == null)
    {
    lookupItem[0] = new LookupControlItem ("{F73AD66F-BDF7-DA11-B79E-000C29B65286}", 129, "ABC");

    oField.DataValue = lookupItem;
    }

    where :
    subjectid is the name of the field,
    "{F73AD66F-BDF7-DA11-B79E-000C29B65286}" is the guid of the default value,
    129 is the type of the default value (by example : subject, account, contact, ...),
    "ABC" is the name which will be written on the form.
Sign In or Register to comment.