The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi all,
I'm working on a Power BI report where users need to update a SharePoint list by clicking a Power Automate button. I have everything working when values are selected from slicers or table visuals (like Request ID, Status, etc.).
However, I'm stuck on how to let the user enter free text input (like a comment) and pass that into the Power Automate flow.
⚙️ Setup so far:
🧩 Problem:
Is there any workaround or clean way to collect user-entered text (like a comment) inside Power BI and pass it dynamically into a Power Automate flow?
Appreciate any help or best practices!
Thanks!
Solved! Go to Solution.
hey, @Sharmilshah ,
You can still use user defined function, you just need to call graph api with delegated access to sharepoint list.
However, you essentially need a registered app with permission to access SharePoint's Graph API to share with the sites you need. Should be delegated per site, it can look like this:
Depends on your admins, but they can grant you this.
And once you have this, you can call graph's rest api for SharePoint, I don't have code at end, but I vibe coded something like this (please note, it can be wrong, just an idea):
import fabric.functions as fn
import logging
import requests
udf = fn.UserDataFunctions()
@udf.connection(argName="sharepoint", alias="mysharepoint")
@udf.function()
def UpdateSharePointComment(
sharepoint: fn.FabricGenericConnection, # Use the right connection type for your setup
site_url: str,
list_name: str,
item_id: int,
comment: str,
access_token: str # Ideally, get this securely or use Managed Identity if possible
) -> str:
logging.info("Processing UpdateSharePointComment")
# Validation
if not comment or not comment.strip():
raise fn.UserThrownError("Comment cannot be empty.")
# Compose SharePoint API URL
url = f"{site_url}/_api/web/lists/getbytitle('{list_name}')/items({item_id})"
headers = {
"Authorization": f"Bearer {access_token}",
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json"
}
# SharePoint expects a PATCH for updates
data = {
"__metadata": {"type": "SP.Data.YourListNameListItem"}, # You must specify the internal list item type
"Comment": comment # Change to your column's internal name
}
# PATCH request
response = requests.post(
url,
headers=headers,
json=data,
params={"$select": "Id"}
)
if response.status_code not in (200, 204):
raise fn.UserThrownError(f"SharePoint update failed: {response.text}")
return f"SharePoint item {item_id} updated with comment '{comment}'."
Hi @Sharmilshah ,
Thanks for posting in Microsoft Fabric Community.
Just checking in to see if have you had a chance to review the information provided by @vojtechsima.
As mentioned, since you're using a workspace with Fabric capacity, you're in a good position to take advantage of the Text Slicer (preview). This allows users to enter free text directly in Power BI, which can then be passed into a User-Defined Function and used within a Translytical Task Flow to update the SharePoint list.
The blog shared earlier by @vojtechsima walks through how to set up native writeback using Fabric, which is relevant for your scenario.
Also as suggested, to write back directly to a SharePoint list, you can use the Graph API. This does require registering an app with the necessary delegated permissions to access the SharePoint site, but once configured, it allows you to update list items, including custom fields like comments.
Please reach out for further assistance.
Also thanks @speedramps for suggesting Power Apps and providing helpful resources. This helps others with similar requirement.
Regards.
Hi @Sharmilshah ,
We wanted to kindly follow up regarding your query. If you need any further assistance, please reach out.
Thank you.
Hi @Sharmilshah ,
Just wanted to check if the responses provided were helpful. If further assistance is needed, please reach out.
Thank you.
Hi @Sharmilshah ,
We wanted to kindly follow up regarding your query. If you need any further assistance, please reach out.
Thank you.
Hi @Sharmilshah ,
Thanks for posting in Microsoft Fabric Community.
Just checking in to see if have you had a chance to review the information provided by @vojtechsima.
As mentioned, since you're using a workspace with Fabric capacity, you're in a good position to take advantage of the Text Slicer (preview). This allows users to enter free text directly in Power BI, which can then be passed into a User-Defined Function and used within a Translytical Task Flow to update the SharePoint list.
The blog shared earlier by @vojtechsima walks through how to set up native writeback using Fabric, which is relevant for your scenario.
Also as suggested, to write back directly to a SharePoint list, you can use the Graph API. This does require registering an app with the necessary delegated permissions to access the SharePoint site, but once configured, it allows you to update list items, including custom fields like comments.
Please reach out for further assistance.
Also thanks @speedramps for suggesting Power Apps and providing helpful resources. This helps others with similar requirement.
Regards.
Hey, @Sharmilshah ,
Sounds like a perfect use case for Fabric's user-defined functions and Translytical task flows.
Power BI now using new Text Slicer as Text Input and you can map it to an action that will write back to your source, it just needs a bit of setup and fabric licence/capacity.
Check out this blog:
https://www.vojtechsima.com/post/native-write-back-in-power-bi-fabric-preview
Thank you @vojtechsima for sharing the TTF option. Your details are excellent. In my use case, I have a sharepoint list as a datasource. I can pull data into Fabric (as I have workspace with Fabric capacity) but my intention is not to just write back to Fabric but want to update end source which is SharePoint list also. I tried to figure out a solution but couldn't find a direct way.
hey, @Sharmilshah ,
You can still use user defined function, you just need to call graph api with delegated access to sharepoint list.
However, you essentially need a registered app with permission to access SharePoint's Graph API to share with the sites you need. Should be delegated per site, it can look like this:
Depends on your admins, but they can grant you this.
And once you have this, you can call graph's rest api for SharePoint, I don't have code at end, but I vibe coded something like this (please note, it can be wrong, just an idea):
import fabric.functions as fn
import logging
import requests
udf = fn.UserDataFunctions()
@udf.connection(argName="sharepoint", alias="mysharepoint")
@udf.function()
def UpdateSharePointComment(
sharepoint: fn.FabricGenericConnection, # Use the right connection type for your setup
site_url: str,
list_name: str,
item_id: int,
comment: str,
access_token: str # Ideally, get this securely or use Managed Identity if possible
) -> str:
logging.info("Processing UpdateSharePointComment")
# Validation
if not comment or not comment.strip():
raise fn.UserThrownError("Comment cannot be empty.")
# Compose SharePoint API URL
url = f"{site_url}/_api/web/lists/getbytitle('{list_name}')/items({item_id})"
headers = {
"Authorization": f"Bearer {access_token}",
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json"
}
# SharePoint expects a PATCH for updates
data = {
"__metadata": {"type": "SP.Data.YourListNameListItem"}, # You must specify the internal list item type
"Comment": comment # Change to your column's internal name
}
# PATCH request
response = requests.post(
url,
headers=headers,
json=data,
params={"$select": "Id"}
)
if response.status_code not in (200, 204):
raise fn.UserThrownError(f"SharePoint update failed: {response.text}")
return f"SharePoint item {item_id} updated with comment '{comment}'."
Consider usiing a Power App visual inside Power BI
learn how for free here
Please click thumbs up because I have tried to help.
Then click [accept solution] if it works.
(It does works, I have used it lots of times and it does exactly what you want).
However, SharePoint is anot the best choice.
Consider using Dataverse or SQL