Hi,
I have a custom entity, where I have to write a combination of two fields into the default field "name".
Most of the records I Import via Scribe and there I know how to set the name field.
But users could also create records themselves and in this case the Name field should be popolated automatically on save.
The Name field should be populated with the text value of a lookup field to entity contact and with the selected option of an option set.
I tried to write JS for that (I never wrote a single line of JS code before and I assume my code is a hughe mess ;)) and Register the according function "on save" for the relevant form.
Unfortunately something seems to be not working, since my form doesn't allow me to save any more. It remains open and no error is being returned.
Any advise would be highly appreciated ;)
thx Thomas
function SetName () {
// Kunde aus Erreichbarkeit
var Kunde
var lookupFieldObject = Xrm.Page.data.entity.attributes.get('tt_contact');
if (lookupFieldObject.getValue() != null) {
Kunde= lookupFieldObject.getValue()[0].name;
}
// Optionset Erreichbarkeitstyp
var Typ = Xrm.Page.getAttribute("tt_typ_erreichbarkeit").getSelectedOption().text;
// Name setzen
Xrm.Page.getAttribute("name").setValue(Kunde + " - " + Typ)
}
*This post is locked for comments