Skip to content

Commit 94eb394

Browse files
committed
Merge branch 'master' into filip-fixes
2 parents eb6fac7 + 74f1999 commit 94eb394

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

powerapps-docs/maker/canvas-apps/sample-crisis-communication-app.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ connect it to your new data sources.
164164
165165
![Import app package](media/sample-crisis-communication-app/31-Import-App.png)
166166

167+
1. Complete the **Import Setup** for **Microsoft Teams Connection** and **Office 365 Users Connection** by selecting the appropriate connections using *Select during import* hyperlink. You may have to create [new connection](add-data-connection.md) if it already doesn't exist.
167168
1. Select **Import**.
168169

169170
### Update the SharePoint connections
@@ -207,6 +208,81 @@ connect it to your new data sources.
207208

208209
1. **Save** and **Publish** the app.
209210

211+
#### Disable ___location updates
212+
213+
This app records a users ___location and stores it in your SharePoint site whenever a user sets their status. This allows your crisis management team to view this data in a Power BI report.
214+
215+
To disable this functionality, follow these steps:
216+
217+
1. Search for the **btnDateRange** control
218+
1. Open the **OnSelect** property of the **btnDateRante** control in the formula bar.
219+
1. Copy and paste the following snippet in the formula bar for **OnSelect** property:
220+
221+
```
222+
UpdateContext({locSaveDates: true});
223+
224+
// Store the output properties of the calendar in static variables and collections.
225+
Set(varStartDate,First(Sort(Filter(selectedDates,ComponentId=CalendarDatePicker_1.Id),Date,Ascending)).Date);
226+
Set(varEndDate,First(Sort(Filter(selectedDates,ComponentId=CalendarDatePicker_1.Id),Date,Descending)).Date);
227+
228+
// Create a new record for work status for each date selected in the date range.
229+
ForAll(
230+
Filter(
231+
RenameColumns(selectedDates,"Date","DisplayDate"),
232+
ComponentId=CalendarDatePicker_1.Id,
233+
!(DisplayDate in colDates.Date)
234+
),
235+
Patch('CI_Employee Status',Defaults('CI_Employee Status'),
236+
{
237+
Title: varUser.userPrincipalName,
238+
Date: DisplayDate,
239+
Notes: "",
240+
PresenceStatus: LookUp(Choices('CI_Employee Status'.PresenceStatus),Value=WorkStatus_1.Selected.Value),
241+
242+
243+
Latitude: Blank(),
244+
Longitude: Blank()
245+
}
246+
)
247+
);
248+
249+
// Update existing dates with the new status.
250+
ForAll(
251+
AddColumns(
252+
Filter(
253+
RenameColumns(selectedDates,"Date","DisplayDate"),
254+
ComponentId=CalendarDatePicker_1.Id,
255+
DisplayDate in colDates.Date
256+
),
257+
258+
// Get the current record for each existing date.
259+
"LookUpId",LookUp(RenameColumns(colDates,"ID","DateId"),And(Title=varUser.userPrincipalName,Date=DisplayDate)).DateId
260+
),
261+
Patch('CI_Employee Status',LookUp('CI_Employee Status',ID=LookUpId),
262+
{
263+
PresenceStatus: LookUp(Choices('CI_Employee Status'.PresenceStatus),Value=WorkStatus_1.Selected.Value)
264+
}
265+
)
266+
);
267+
268+
If(
269+
IsEmpty(Errors('CI_Employee Status')),
270+
Notify("You successfully submitted your work status.",NotificationType.Success,5000);
271+
272+
// Update the list of work status for the logged-in user.
273+
ClearCollect(colDates,Filter('CI_Employee Status',Title=varUser.userPrincipalName));
274+
275+
Navigate('Share to Team Screen',LookUp(colStyles,Key="navigation_transition").Value),
276+
277+
Notify(
278+
LookUp(colTranslations,Locale=varLanguage).WorkStatusError,
279+
NotificationType.Warning
280+
)
281+
);
282+
283+
UpdateContext({locSaveDates: false})
284+
```
285+
210286
### Update the request help Flow
211287

212288
This flow will send an adaptive card to a central Teams team requesting help.

0 commit comments

Comments
 (0)