Dynamics 365 Dialog Field MultiSelect Lookup Method
Bayram ÇETİN
2 min read
Yazıya buradan ulabilirsiniz: https://bayramcetin.com/dynamics-365-dialog-lookup-override
Bu yazıda, Dialog field Lookup'ını nasıl çoklu seçim yapılabilir hale getirebileceğimizi gösteren bir class paylaşmak istiyorum. Umarım faydalı olur. Bir sonraki yazıda görüşmek üzere.
class ETGCeremonyResponsibleAddMultiLine
{
ETGCeremonyTable record;
str dialogValue;
public void lookupPerson(FormStringControl _formControl)
{
Query query = new Query();
QueryBuildDataSource queryBuildDataSource = query.addDataSource(tableNum(HcmWorker));
queryBuildDataSource.addSelectionField(fieldNum(HcmWorker, Person));
container Person;
SysLookupMultiSelectGrid::lookup(query,_formControl,_formControl,_formControl, Person);
}
private boolean dialog()
{
Dialog dialog = new Dialog("Tören Sorumluluları ekle");
DialogField field = dialog.addField(extendedTypeStr(String500), "Tören sorumlusu");
field.registerOverrideMethod(methodStr(FormStringControl, lookup),
methodStr(ETGCeremonyResponsibleAddMultiLine, lookupPerson), this);
if(dialog.run())
{
if (!field.value())
throw warning("Tören sorumluluları seçiniz.");
dialogValue = field.value();
return true;
}
return false;
}
private void run()
{
if(this.validate() && this.dialog())
{
ETGCeremonyResponsible etgCeremonyResponsibleNew;
RecId person;
List strlist = new List(Types::Int64);
strlist = strSplit(dialogValue, ";");
ListIterator it = new ListIterator(strlist);
ttsbegin;
while (it.more())
{
person = it.value();
etgCeremonyResponsibleNew.clear();
etgCeremonyResponsibleNew.CeremonyNumber = record.CeremonyNumber;
etgCeremonyResponsibleNew.PersonnelHcm = HcmWorker::findByPerson(person).RecId;
etgCeremonyResponsibleNew.insert();
it.next();
}
ttscommit;
info(strFmt("Tören sorumluları oluşturuldu."));
}
}
private boolean validate()
{
boolean isValid = true;
return isValid;
}
public ETGCeremonyTable parmRecord(ETGCeremonyTable _record = record)
{
record = _record;
return record;
}
public void new()
{
}
public static ETGCeremonyResponsibleAddMultiLine construct()
{
return new ETGCeremonyResponsibleAddMultiLine();
}
public static void main(Args _args)
{
if (! _args || ! _args.dataset() || ! _args.record() ||
_args.record().TableId != tablenum(ETGCeremonyTable))
{
throw error(Error::missingRecord(funcname()));
}
ETGCeremonyResponsibleAddMultiLine process = ETGCeremonyResponsibleAddMultiLine::construct();
process.parmRecord(_args.record());
process.run();
}
}
0
Subscribe to my newsletter
Read articles from Bayram ÇETİN directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Bayram ÇETİN
Bayram ÇETİN
Senior Dynamics 365 Developer