0

I want an spfx made webpart that I've made be able to send an email (I'm using IEmailProperties at the moment) which provides a link to a modal form?

For example:

  1. User clicks button in webpart, form loads.
  2. User fills out form and submits it to SP list.
  3. Form sends email on submission. Email has a link to the actual item created, so when the user clicks the provided email link, it opens up the modal form.

I would presume that the user would HAVE to be sent to the SP page where the webpart is unconditionally, but would it be possible to open up the modal corresponding to the SP list item?

Is this feature available in SharePoint framework, because if it isn't, compared to something like InfoPath 2013 or PowerApps it's quite a limitation. I've researched this with several shallow Google searches and on gitHub for any premade stuff, but alas there is nothing that I've spotted.

I've been told IT IS possible:

"Yeah, they’d have to visit the page. Email clients don’t do JavaScript so you can’t really do interactive stuff there. If you want to take them directly to a page that then displays a modal, that’s plenty possible though. (e.g. display the modal based on if the URL contains a certain string)"

But wouldn't know how to do the above, can anyone start me on the right path?

Regards,

T

NightTom
  • 418
  • 15
  • 37
  • I don't quite get the 'modal form' aspect. Are you just seeing how to link the user to see the list item? If so you can just navigate to the list item and click 'copy link'. You will notice that its just linking it by list item id, which you can automate as part of your email you are sending out. If you are trying to view the item with a custom view, then you can link to the webpart itself and pass query string parameters so that it can load up its own view of the data. – m1g Dec 26 '20 at 19:49
  • Hi @m1g - sry it's taken me a long time to respond. I'm trying to link directly to a webpart made in SPFX. So they click the link, it then opens up a modal which displays the correct list item. How would I pass query string parameters to it can load up it's own view of the data? – NightTom May 24 '21 at 10:12

1 Answers1

0

In the email, pass a query string containing the item ID/list ID etc of the item, then have the webpart read the See: How can I get query string values in JavaScript? If your values exist. If they do exist, then open the modal using some kind of framework like bootstrap or fluent UI. You can write your own form using PnPjs or use an iframe potentially to display the OOTB edit form.

Additionally, you can link to any page in SharePoint provided you use an extension instead of a webpart to host the modal. You can install extensions tenant wide, and have it listen for the query string.

m1g
  • 108
  • 8