Update List Item


Definition

The "Update List Item" action allows a user to modify an existing item within a specified SharePoint list. By providing the unique identifiers for the site, list, and the specific item, you can programmatically change the values in one or more columns of that item.

  • Key capabilities:
  • Identifies a specific SharePoint site and list using their respective IDs.
  • Targets a unique list item for modification using its Item ID.
  • Updates the data in selected columns of the specified item.

This action is essential for automating data management processes, ensuring that information in SharePoint lists remains accurate and up-to-date without manual intervention.


Inputs

  1. connection Establishes the authenticated connection to your SharePoint environment, granting the necessary permissions to access and modify list items.
  2. Site ID The Site ID is a unique identifier for a SharePoint site (or a Microsoft 365 Group site) within an organization's SharePoint environment. Every SharePoint site, including team sites, communication sites, and OneDrive for Business sites, has a unique Site ID that must be provided to locate the correct list.
  3. List ID This is the unique identifier for the SharePoint list containing the item you wish to update. As each site can contain multiple lists, you must enter a specific List ID or select the desired list from the drop-down menu that appears after a connection is established.
  4. Item ID The Item ID is the unique identifier for the specific item you want to update within the selected SharePoint list. Each item is assigned a distinct ID by SharePoint, which is required to target the correct record for modification.
  5. Columns to Fill This input allows you to select the specific columns of the list item that you want to update. After selecting the list, its columns will be displayed, and you can provide new values for them. Note that certain field types like Image, Location, and Metadata (Multiple Values) are not supported. If you make changes to the list's columns in SharePoint, you must use the reload button to reflect those updates in zenphi.

Outputs

  1. Site ID The unique identifier of the site where the list item was updated.
  2. List ID The unique identifier of the list where the item was updated.
  3. ID The unique identifier of the updated item.
  4. GUID The Globally Unique Identifier (GUID) of the updated item.
  5. Created Date/Time The original date and time when the list item was created.
  6. Last Modified Date/Time The date and time when the list item was last modified, which will reflect the time this action was executed.

Example Use Cases

  1. Update Request Statuses Automatically change the status of a request in a SharePoint list (e.g., from "Pending" to "Approved") after a manager completes an approval task.
  2. Log Approval Details Record the approver's name, comments, and the approval date directly into the corresponding list item for auditing and tracking purposes.
  3. Sync Data from Other Systems Keep SharePoint lists current by updating items with fresh data from external sources like a CRM, ERP, or another database.
  4. Manage Inventory Levels Adjust the quantity of an item in an inventory tracking list whenever a sale or restocking event occurs in another system.
  5. Track Project Milestones Modify a project tracking list to reflect when a task is completed, a milestone is reached, or a deadline is changed.

Example

Scenario: An IT department uses a SharePoint list to track all hardware requests. When an employee submits a request, a new item is created with a "Pending Approval" status. The IT manager needs to approve or reject the request, and the SharePoint list must be updated automatically to reflect their decision, the approver's name, and the date of the decision.

Steps to Implement:

  1. Trigger the Flow: Start the zenphi Flow with a trigger, such as a "New Item is created" trigger for the SharePoint hardware request list.
  2. Assign an Approval Task: Use an action like "Assign a Task" to send the request details to the IT manager for their review and decision.
  3. Configure the "Update List Item" Action: Place this action immediately after the approval task is completed.
  • Connection: Select your established SharePoint connection.
  • Site ID: Choose the SharePoint site where the hardware request list is located.
  • List ID: Select the "Hardware Requests" list from the dropdown.
  • Item ID: Use the token picker to dynamically insert the Item ID from the initial trigger (the "New Item is created" action). This ensures you are always updating the correct request.
  • Columns to Fill:
  • Status: Use the token picker to insert the outcome from the "Assign a Task" action (e.g., "Approved" or "Rejected").
  • Approver: Insert the token representing the name or email of the person who completed the task.
  • Approval Date: Use a zenphi variable or function to insert the current date and time.
  1. Add a Notification Step: Optionally, add an email or Microsoft Teams message action to notify the original requester that their request status has been updated.

Outcome: By automating this process, the SharePoint list becomes a reliable, real-time source of truth for all hardware requests. The IT department saves time by eliminating manual data entry, reduces the risk of human error, and ensures that employees are automatically notified of the decision. This creates an efficient, transparent, and auditable approval workflow.


Best Practices

  1. Use Dynamic Item IDs: Always use a token from a trigger or a previous action to populate the Item ID field. Hardcoding an ID will cause the Flow to update the same item every time it runs, which is rarely the desired behavior.
  2. Validate Data Before Updating: Before the Update List Item action, consider adding a condition to validate the data you are about to write. This prevents incorrect or improperly formatted information from being saved to your SharePoint list.
  3. Refresh List Schema: If you add, remove, or rename columns in your SharePoint list, remember to click the "reload" button in the Update List Item action's configuration. This ensures zenphi fetches the latest column structure, making the new fields available for updates.
  4. Implement Error Handling: Consider what should happen if the action fails (e.g., the item was deleted or the connection fails). Use zenphi's error handling capabilities to define a fallback path, such as sending a notification to an administrator to investigate the issue.