Public form - Dropdown value from SharePoint list

Hello,

Is it possible to fill out dropdown field with the values of a SharePoint list using the Public Form? I know it can be done with the SP form, but I need it done with the Public form.

Thanks,

Alberto

Hello @avs270,

Welcome to Plumsail Community!

If the public form is published in SharePoint, this can be done using the code from this article.

Otherwise, this can be done using MS Graph, but in this case, each user of the form must be authenticated.

Are you considering a paid support option?

We can integrate Public Forms with MS Account. You will be able to turn on authentication via MS Account for specific forms. Thus a user will need to sign into his MS Account before using such forms, and the user will be able to use MS Graph without additional authentication. Also, we will provide corresponding JS-code to populate fields with SharePoint lists data.

If you are interested, please contact us via support@plumsail.com

Hello,

Thank you for the reply. If I understand correctly, the only way to have this done is to have the form show within SharePoint (which requires SharePoint Online licensing) or to have a MS account for the user opening the public form. In other words, this cannot be done with pure anonymous access.

Please confirm.

Thanks,

Alberto da Silva

Hello @avs270,

Yes, that is correct. If you store data in the SharePoint list and want to access it, you need to be authorized.

1 Like

Hello @avs270,

We published an article that may be useful for you. It's on how to populate drop-down lists in public Plumsail forms with data from a SharePoint list. The form will still be anonymous. You can find it on Medium:

1 Like

Thank you, in the example below. Are we able to query the values that we want to bring from the SharePoint list. I do not want to bring all values. If so, where would this be done?

Hello @adasilva,

You can change the Query options in the ListData.cs file in your copy of our repository on GitHub, the path of the file is:
data-source-functions/FunctionApp/SharePoint/ListData.cs

1 Like

Hi Margarita,

What if we used Azure SQL Database instead of SharePoint list. How would we connect to it from an external form?

Thanks,

Alberto da Silva

Hello @adasilva,

Unfortunately, right now there is no one method to get data from SQL server to forms. I would recommend getting the data copied from SQL server to SharePoint via MS Flow.

Ok, but what if I want to have multiple connections to different lists? With different Queries?

Would I need to have multiple copies of your repository? multiple copies of the ListData.cs?

Ok, I was able to query a different SP list by creating a new organization on GitHub and forking your repository to it. Let me know if there is a more efficient way to do it.

Question, this is working on Form Load. Would it be possible to use this method to query a SP list through a parameter indicated on the Public Form. In other words, I dont' want to load info on Form Load, I want the user to select a value from a dropdown, click a button and then the query runs, grab the values based on the parameter on the form and bring it back to the public form.

Please let me know.

Thanks,

Alberto

Hello @adasilva,

You can call function not only on form load. For instance, you can call function when the field is changed and pass the field value in query parameter.

Thank you, how would it look like in the ListData.cs file in GitHub? Like the bolded value below?

var queryOptions = new List()
{
new QueryOption("filter", "fields/Location eq @LocationValue),
new QueryOption("select", "id"),
new QueryOption("expand", "fields(select=Title,Author,Location)")
};

Also, can you please provide an example as to how I would pass the parameter?

Would I pass the parameter in the script below? If so, where?

var widget = fd.field('RegionUS').widget;
widget.setDataSource({
transport: {
read: 'YYYYYYYYYYY'
}
});
widget.setOptions({dataTextField: 'fields.Title', dataValueField: 'fields.Title'});

Another question, is it possible to have a Power Automate workflow run when I click a button on the public form (without closing it). After the workflow finishes it would display the result in a text field?

Hello @adasilva,

Are you considering a paid support?

We can help you out with the code that filters the external list dynamically. If you are interested please send us a detailed description of your case by email: support@plumsail.com