web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filter the "Required A...
Power Apps
Unanswered

Filter the "Required Attendees" Field

(0) ShareShare
ReportReport
Posted on by

Hi Community:

 

I'm almost a new developer here in Powerapps but I can manage my way thru, so I found out that we can use CDS to get entities all ready to use, however, when I use the "Appointment" entity I need to filter the "Required" filed that comes in the main form called "Appointment". By default, this field is linked to several entities but I just need to get the contacts entity to be shown in the current view and nothing else.

 

second higlighted valuesecond higlighted value

 

I've read that we can use JS to do this but my JS knowledge is null, if someone could of help me to do this or provide a link with a step by step solution I would really appreciate all of your help 

I have the same question (0)
  • Ben Thompson Profile Picture
    1,400 on at

     

    You will need the following (it's untested but should work as it's just the code from https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/225447/party-list-customization-in-appointment-form/627140 converted without testing to use context rather than Xrm.page.

     

    function onLoad(context){
    var formContext = context.getFormContext();
    var lookupDataOAReqAttendees = formContext.getAttribute('requiredattendees').getLookupDataAttribute();
    lookupDataOAReqAttendees.setLookupTypes(['contact']); 
    }

     

    Just add that script to a javascript library and run it on pageload passing in the executioncontext as the first parameter by checking the checkbox.

  • EricRegnier Profile Picture
    8,720 Most Valuable Professional on at

    HI @Anonymous,

    There are a few ways you can approach this, top 2 that come to mind are:

    1. Create a sync aka real-time workflow to ensure only contacts are entered. Configure the workflow to run in real-time on create of update of Recipient/Required. If users tries to enter anything else, the system will through an error. Here's an example of the workflow and error:
      2020-09-22_19-49-06.png
      2020-09-22_19-50-39.png

    2. Create (or update) a new Appointment form and a new Contact lookup field. Add the new field to the form to replace the original field. 
      Note: make sure you also update (or create new) the quick create appointment form because the original field is also there. Note 2: if you create new forms, remove the old Appointment and quick create forms from your model-driven app.

    Hope this helps!

  • Ben Thompson Profile Picture
    1,400 on at

    @EricRegnier How do those approaches restrict the access on the form to just contacts without breaking the behind the scenes O365 diary functionality and by breaking the required attendees field you are going to end up with a Outlook appointment that doesn't match the D365 / power app appointment record.

  • EricRegnier Profile Picture
    8,720 Most Valuable Professional on at

    If you’re referring to appointment sync with Exchange integration, then I’m assuming @Anonymous is not syncing appointments.

  • Community Power Platform Member Profile Picture
    on at

    Hi All:

     

    as @EricRegnier mentions, I will not sync with outlook yet, maybe in the future, now I'm using a flow to create a google event because my team has the google suite but maybe in a near-future my team and I will move over to O365.

     

    Let me give it a try to what both of you mentioned and let you know the outcome. 

     

    Thank you all

  • Community Power Platform Member Profile Picture
    on at

    Hi @ben-thompson 

     

    I tried your solution today morning and it gave me the following messages (probably is my null knowledge in JS):

     

    so I added the script here to the left and its called cr856pwfs_hideentities:

     

    Entity4.png

     

    and then I guessed that the function was the one inside of the script so I added to the function box on the right. but it gave me this error message:

     

    Entity5.png

     

    I also attached the error log. 

    Thank you

  • Verified answer
    Ben Thompson Profile Picture
    1,400 on at

    Try this 

     

    function onLoad(context){
     var formContext=context.getFormContext();
     var c=formContext.getControl('requiredattendees').getAttribute();
     var e=c.getAttrDescriptor().Targets;
     var f=e.length;
     for (var g=0; g<f; g++){
     e.pop();
     }
     e.push("contact");
    }

     

     which is the direct approach to the wrapper that seems to no longer exist.

     

    This should just work as I was annoyed enough to experiment and find a suitable fix.

  • Community Power Platform Member Profile Picture
    on at

    Hi @ben-thompson 

     

    This Actually did the trick thank you for your time and your input !

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard