Hi,
In my app there is a gallery to display all tickets and then there is a view details page. If the user wants to edit it user has to click "Edit" button and then can go to edit form. In the edit form, there is a closed date field. I need to set that closed date according to the status. There is a drop down to select status.
Scenario 1:
If the status of the ticket is new, by default closed date should be empty. If user changes status to Closed, then closed date should be set to current date. If changed again to new, then closed date should be empty.
Scenario 2:
If the status of the ticket is already closed, by default closed date should be that previously closed date, not current date. Then, If user changes status to new, closed date should be empty. If again changed to closed, closed date should be previously closed date.
In order fulfill this requirement, I added below statement to Default Date property of Date picker.
Switch(
IsClosedPreviously,
true,
If(
IsStatusClosed,
EditRecord.'Closed Date'
),
false,
If(
IsStatusClosed,
Today()
)
)
IsClosedPreviously and IsStatusClosed variables are initialized in App OnStart property as below.
Set(IsClosedPreviously, false);
Set(IsStatusClosed,false);
Then, I set the values to these variables in OnSelect property of Edit Button of the View details page, that I mentioned above. I did that because I need to check whether it is closed or not before loading edit form. So, when clicking the edit button those variables will be set and then load the default closed date according to those variables.
Onselect property of edit button is as below.
Set(IsClosedPreviously, If(EditRecord.Status.Value="Closed", true,false));
Set(IsStatusClosed,If(IsClosedPreviously, true, false));
In this way scenario 1 happens as I want. But Scenario 2 has an issue.
In scenario 2- At the first time I load the edit form, default date is set to current date. But in scenario 2 it should be previous closed date, not current date. when I go back and come again to the form, default date sets to previous date as I want. I want to do it without going back and come.
please help me to solve this issue.
Regards,
Nipuni

Report
All responses (
Answers (