Skip to main content
Jenisha Nadiyadra (tcs) a posé une question dans #Cloudcraze

Hi all,

I am trying to create a choose file button on B2B commerce cloudcraze for payment page during checkout. I need to put a file uploader on that page and when user select the file from choose file button and clicks on complete order. The attachment should be save on the order's relatedList of Notes and Attachments.

#Cloudcraze #ECommerce #Ecommerce Website ##cloudcraze @ecommerce#B2B Commerce #B2B Commerce Technical Training
1 réponse
  1. 21 mai 2023, 01:00

    To achieve the desired functionality in Salesforce Commerce Cloud (formerly known as CloudCraze), you can follow these steps to implement the "choose file" button and store the selected file in the related list of Notes and Attachments for an order:

    1. Create a custom Visualforce page or Lightning Component for the payment page during checkout in Salesforce Commerce Cloud. This component will include the "choose file" button and handle the file upload process.
    2. Add an input element of type "file" to your custom Visualforce page or Lightning Component. This element will serve as the "choose file" button for the user to select the file they want to upload.
    3. Implement JavaScript or a client-side framework (like jQuery) to handle the file selection and upload process. You'll need to listen for the change event on the file input element and retrieve the selected file.
    4. Once the user selects a file, use Salesforce's JavaScript Remoting or a REST API call to send the file to a server-side controller or an Apex class.
    5. In the server-side controller or Apex class, create a new Attachment record using the selected file. Set the ParentId of the Attachment record to the relevant order's ID to associate it with the order.
    6. Save the Attachment record to Salesforce, which will automatically create a new related list entry in the Notes and Attachments related list for the order.

    By following these steps, you'll be able to create a "choose file" button on the payment page in Salesforce Commerce Cloud and store the selected file as an attachment in the related list of Notes and Attachments for the corresponding order.

0/9000