Hi guys,
I can't change the default view "msevtmgt_event...." for the registration lookup on quick create for a event check-in. The view is not customizable by myself. Event I set another view - the default view stays the same. It seems like a bug.
Any suggestions?
Regards,
Martin
Hi Martin,
Thanks for your feedback.
I forgot that we need to take url params from "parent.location.href" instead of "location.href", because the script is running on quick create form.
(Quick create form could be regarded as child page of the parent main form.)
Moreover, I didn't notice that Event field had been added to the Check-in quick create form by default.
Therefore, obviously your method that taking Guid of the event from the field on the form is a better solution.
In Dynamics, only client API(such as formContext.getAttribute) is the supported solution, however, "Taking url params" may works for situation when lookup field for parent entity is not added to quick create form.
Anyway, it is very glad that your problem has been solved.
Regards,
Clofly
Hi Clofly,
your answer is quite good, but this part "var eventId = new URLSearchParams(location.href).get('id');" throws an exception, because "get" is undefinied.
Instead of using the url I take the Guid of the event from the field on the form.
Furthermore is "taking url params" a "supported" solution because we are working with DOM - don't we?
Solution works!
Regards,
Martin
Hi Martin,
You could inject custom layoutXml and fetchXml to the Event registration field by executing the custom javascript function at OnLoad event of quick create form of Check-in.
Sample code:
function customView(executionContext) { var eventId = new URLSearchParams(location.href).get('id'); var formContext = executionContext.getFormContext(); var fetchXml = '' '' '' '' '' '' '' '' '' '' '' '' '' ''; var layoutXml = '' "" "" "" "" "" ""; formContext.getControl("msevtmgt_registrationid").addCustomView('6db26390-685a-4d19-a274-aeaa771f1b5c', 'msevtmgt_eventregistration', 'Clofly View', fetchXml, layoutXml, true); }
It will inject a custom view with custom layout(custom columns) to the event registration field and set it as the default view.
We can add columns we want to the layoutxml cell node, but they should have been queried from fetchxml.
(Columns I set: Registration ID, contact name and createdon date.)
To only show associated records of the current event, we use following syntax to get id of the current event.
var eventId = new URLSearchParams(location.href).get('id');
The custom injected view will be available in the list.(It only exists on the quick create form and it will not affect the default "hardcoded" view.)
Please refer to following articles to learn about addCustomView function and its example.
https://www.c-sharpcorner.com/blogs/filtering-lookup-based-on-the-link-entity
Regards,
Clofly
Hi Clofy,
yes - we have published it. The Problem is, by default the "hardcoded" view is set always. If we change the view, we are losing the filter ("filtered by related contacts").
This behavior only appears on this lookup field - There is no customization or coding from us.
My requirements are: Either change the columns of the default view or change the default view.
Regards,
Martin
Hi Martin,
Not sure whether the default msevtmgt_eventregistration_by_msevtmgt_event (default) view is customizable, because it is used to show all event registration records that are associated with current event,
therefore, it is recommended that not to customize it.(And it seems that the view is hardcoded.)
Could you let me know how did you change the default view?
From my test, in powerapps editor > entities > check-ins > quick create form, we can change the default view and allow users to change view.
Make sure that you have saved and published the form, and try to refresh page twice to check again.
Regards,
Clofly
Holly Huffman
103
Muhammad Shahzad Sh...
96
Most Valuable Professional
Gerardo RenterÃa Ga...
51
Most Valuable Professional