Finsweet Dynamic Filtering with the email from Memberstack Login


I have a requirement to filter a CMS list based on the email of the user logged in using memberstack. I tried using Finsweet dynamic filter and the set-up seems to have worked. But the issue is that the filtering with email is not happening and if I type a value in the input filter field, then it works. It is not picking up the value populated from membersstack (attribute data-ms-member = “email”).

My understanding is that the finsweet filter has to be retriggered through custom code. Can someone help with a code sample if that is the case?

Site - https://pytf-new-merged-and-improved-site.webflow.io/

Here is my site Read-Only: [ Webflow - PYTF NEW MERGED AND IMPROVED SITE ]

page is “Crowd Funding Profile”

1 Like

See the Button click or scripting event section of my notes here-

1 Like

Hey @gopal_aparna ,

You could probably set the email ID programmatically and trigger Finsweet filter for this use-case.

<script>
  window.FinsweetAttributes = window.FinsweetAttributes || [];
  window.FinsweetAttributes.push([
    'list',
    (listInstances) => {
      const [listInstance] = listInstances;
      window.$memberstackDom.getCurrentMember()
        .then(({ data: member }) => {
        const userEmail = member?.auth?.email;
        if (userEmail) {
          const targetCondition = listInstance.filters.value.groups[0]?.conditions[0];
          if (targetCondition) {
            targetCondition.value = userEmail;
          }
        } 
      })
        .catch((error) => {
      });
    },
  ]);
</script>

You can remove the data-ms-member="email" attribute from the field if you want as this code should work regardless.

You can further modify the script as per your requirement, I just tested your use-case in a dummy site with Finsweet v2 dynamic filters to see if this approach works and it does and populates the relevant CMS items.

Hope this gives you some idea.

1 Like