I have created an extension in the validateWrite method of the EssLeaveRequestEntry form
What I am doing is selecting 2 records, then clicking update time off. Then a window opens and I change the date via the datepicker to a new date.
Now when I click submit, I enter my validateWrite extension and here I want to execute some logic, for the records I selected on the base form.
When only 1 record is selected, I can obtain it with:
*LeaveRequestCalendar requestToEdit = element.args().record();
However I cannot get it to work to select multiple records. I tried the following 3 solutions I found:
SOLUTION 1:
MultiSelectionContext selectionContext;
selectionContext = element.args().multiSelectionContext();
LeaveRequestCalendar leaveRequestOld;
if (selectionContext && selectionContext.getFirst())
{
while(selectionContext)
{
daysList.addEnd(leaveRequestOld.LeaveDate);
leaveRequestOld = selectionContext.getNext();
}
daysList.empty();
}
Problem: This solution gives me a timeout without ever getting through the logic
SOLUTION 2:
FormDataSource requestFds = element.args().record().dataSource();
LeaveRequestCalendar leaveRequestOld2 = requestFds.getFirst();
while(leaveRequestOld2)
{
daysList.addEnd(leaveRequestOld2.LeaveDate);
leaveRequestOld2 = requestFds.getNext();
}
daysList.empty();
Problem: This solution gives me ALL the records of the datasource, not just the selected ones
SOLUTION 3:
MultiSelectionHelper helper;
helper = MultiSelectionHelper::createFromCaller(element.args().caller());
LeaveRequestCalendar leaveRequestOld3 = helper.getFirst();
while(leaveRequestOld3)
{
daysList.addEnd(leaveRequestOld3.LeaveDate);
leaveRequestOld3 = helper.getNext();
}
daysList.empty();
Problem: This solution also gives me ALL the records of the datasource, not just the selected ones
I probably am missing something in my code, but I would not know what. Could someone tell me how I can get the wanted functionality?