In a previous post, I demonstrated how to add the Schedule Board into Unified Client Interface (UCI) App or Unified Interface (UI) App. Microsoft is working hard to get UCI feature parity with Web UI but some important features are not there yet. In this post, I am going to demonstrate how to add the Work Hours Form into a Unified Interface form.
Work Hours Form in Web UI
Open the Resources view.
Option 1: Field Service > Administration > Resources
Option 2: Resource Scheduling > Scheduling > Resources
Option 3: Project Service > Resources > Resources
Click on a Resource to open the record.
Click on the arrow next to resource’s name and click Work Hours.
You can now see the Work Hours Form. This form is used to set the work hours of the resource. In this post, I will not go into details about how to set up the work hours.
Add Work Hours Form into Resource Form in UCI
In UCI, Work Hours form is not available. Following steps are required to display the Work Hours form in Resource form.
Step 1 – Create a Web Resource which displays the Work Hours form
Step 2 – Insert the Web Resource to a section in the Tab
Step 3 – Add a new Tab “Work Hours”
Step 1 – Create a Web Resource which displays the Work Hours form
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<html> <head> <script> function OnLoad() { var baseURL = window.parent.Xrm.Page.context.getClientUrl(); var resourceId = window.parent.Xrm.Page.data.entity.getId(); var src = baseURL + "/biz/users/monthlyCalendar.aspx?formid=3e8942a7-ff8e-4634-84ec-8ce174ab807c&oId=" + resourceId + "&oType=1150&pagemode=iframe&rof=true&security=852023&tabSet=areaMonthlyCalendar&theme=Outlook15White"; document.getElementById('workhours').src = src; } </script> </head> <body onload="OnLoad()" style="word-wrap: break-word;"> <iframe id="workhours" src="" frameborder="0" style="overflow:hidden;height:100%;width:100%" height="100%" width="100%"> </body> </html> </iframe> </body> </html> |
Below are the important sections in the code.
Get the Base Url of the instance
1 |
var baseURL = window.parent.Xrm.Page.context.getClientUrl(); |
Get the GUID of the Resource
1 |
var resourceId = window.parent.Xrm.Page.data.entity.getId(); |
Configure the Url of the Work Hours form
1 |
var src = baseURL + "/biz/users/monthlyCalendar.aspx?formid=3e8942a7-ff8e-4634-84ec-8ce174ab807c&oId=" + resourceId + "&oType=1150&pagemode=iframe&rof=true&security=852023&tabSet=areaMonthlyCalendar&theme=Outlook15White"; |
formid is a constant for all instances.
oId is the Resource record’s GUID.
oType is a constant for all instances.
iFrame to show the Work Hours form
1 |
<iframe id="workhours" src="" frameborder="0" style="overflow:hidden;height:100%;width:100%" height="100%" width="100%"> |
Note that the src attribute is empty.
The OnLoad() function runs on load of the form. It extracts Resource record’s GUID and creates the full Url of the Work Hours form and sets the src attribute of the iframe. Create a web resource and publish.
Step 2 – Insert the Web Resource to a section in the Tab
Now Insert the web resource into the section on the Work Hours tab.
Note the settings of the above images. Layout = One Column, Number of Rows = 20, Automatically expand to use available space = tick, Scrolling = As Necessary.
Click OK and Publish the form.
Now the Work Hours form is visible on UCI Resource Form. OOTB, UCI Apps don’t have the Bookable Resources entity. You’ll need to add that in.
Thank you for visiting Dyn365Apps.com.
Follow me on Twitter to get the latest news, tips and tricks and more …
Until next time…
About the Author
Nadeeja Bomiriya is a Microsoft MVP, Chapter Lead – Dynamics 365 Saturday – Australia, President – Melbourne Dynamics 365 User Group, Technical Architect, and Dynamics 365 Practice Lead who lives in Melbourne, Australia.