Forum Discussion
Generate a bar code for the sharepoint list item Id, is this possible
I have an Assets SharePoint list. And using Power Apps , i want to generate a barcode which represents the Item Id when creating a new list item inside the Assets list, then save the bar code back to SharePoint.. can i achieve this using power apps?
- wfrf92Copper ContributorYes, you can generate a barcode representing the Item ID in Power Apps and save it to a SharePoint list. To achieve this, follow these steps: 1. Create a Barcode in Power Apps: - Power Apps provides the `BarcodeScanner` control. You can add this control to your app, but you won't need to use it as a scanner in this case. - To generate a barcode, you can use the `Barcode` control. Add it to your form or screen where you collect the information for a new list item in your Assets SharePoint list. - Set the `BarcodeType` property to the desired barcode type, such as "QRCode." - Set the `Text` property of the barcode control to the Item ID or any other relevant data that you want to encode. 2. Save Barcode to SharePoint: - When the user submits the form or initiates the process to create a new item, you can use the `Patch` or `SubmitForm` function to save the data to the SharePoint list. - In the `Patch` or `SubmitForm` function, include a field for the Barcode. For example: Patch( YourSharePointList, Defaults(YourSharePointList), { // Other fields Title: TextInputTitle.Text, Description: TextInputDescription.Text, Barcode: Barcode.Text // Assuming Barcode is the name of your Barcode control } ) This code will save the generated barcode value along with other item information to the SharePoint list. 3. Generate the Barcode Automatically: - If you want the barcode to be generated automatically as soon as you start creating a new item in the SharePoint list, you can generate it in the `Default` property of the Barcode control. For example: Default: "ItemID-" & Text(Gallery1.AllItems, "[$-en-US]0") This formula generates a default barcode based on "ItemID-" followed by a unique number. You might need to adjust this formula according to your specific requirements. Test your app by creating a new item in the Assets SharePoint list. The barcode should be generated automatically, and when you save the item, it should be saved along with the rest of the information in SharePoint.
- john johnSteel Contributor
wfrf92 thanks for the reply..also seems SharePoint itself offer the ability to generate barcode for the item as per this video @ https://www.youtube.com/watch?v=EnKoaYObSLs .. so should i follow this approach or your approach ? Thanks
- wfrf92Copper Contributor
john john , SharePoint does indeed offer the ability to generate barcodes for items, and the approach you choose should depend on your specific requirements and the features available within SharePoint. To decide whether to use SharePoint's built-in barcode generation or the approach I previously mentioned, you should consider the following factors:
SharePoint's Built-In Features: SharePoint's built-in barcode generation may be sufficient for your needs, especially if you only require simple barcode generation for items within your SharePoint environment. Review the features and capabilities provided by SharePoint for barcode generation and determine if they meet your requirements.
Customization: If you need more advanced customization or integration with external systems, the approach I mentioned earlier (using PowerApps or a custom solution) might be more suitable. This approach allows for greater flexibility in generating and using barcodes, particularly if you have specific business processes or workflows that require custom solutions.
Complexity: Consider the complexity of your barcode generation requirements. If it's a straightforward process and SharePoint's built-in features can handle it, that might be the simplest and most cost-effective solution. However, if your requirements are more complex or unique, a custom solution might be necessary.