Salesforce Mobile App Improvement for Uploading Files
When trying to upload a file using the Salesforce Mobile App on an iPhone, out of the box Salesforce Mobile functionality does not allow access to files. The only options are Use Latest Photo, Take Photo, or Pick from Camera Roll. This may work if you need to upload a picture, but what about other files on your iPhone?
Here is Salesforce’s official response (TLDR; NOT easy to link the file to a record on iPhone).
Open up the File on the device, choose the share feature and the "Copy to Salesforce" button. See Apple Documentation: Use the Files app on your iPhone, iPad, or iPod touch.
After sharing into Salesforce App, the newly created Salesforce File will now show up in the "Owned By Me" Files list.
You can then associate it to the Salesforce record using the Post or File action and choose the File from within Salesforce.
As developers, we know we can provide a better experience for our customers.
To make this process easier, a Lightning Web Component (LWC) was created using the lightning-file-upload tag. The LWC was added to the Lightning Record Page as new tab.
force-app/main/default/lwc/myComponent/myComponent.html
<template>
<lightning-card>
<lightning-file-upload
label="Attach File"
name="fileUploader"
record-id={recordId}
multiple>
</lightning-file-upload>
</lightning-card>
</template>
force-app/main/default/lwc/myComponent/myComponent.js
import { LightningElement, api } from 'lwc';
export default class VendorBid extends LightningElement {
@api recordId;
}
One of the keys needed to make the LWC available on mobile is by updating the XML file to add the supported Form Factors.
In our situation, the goal was to only show this tab in the mobile app and not in the browser on the user’s computer.
If you want it show in Large form factors, you would just another supported form factor for Large.
force-app/main/default/lwc/myComponent/myComponent.js-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>55.0</apiVersion>
<isExposed>true</isExposed>
<masterLabel>File Upload for Mobile</masterLabel>
<description>File upload for mobile</description>
<targets>
<target>lightning__RecordPage</target>
</targets>
<targetConfigs>
<targetConfig targets="lightning__RecordPage">
<supportedFormFactors>
<supportedFormFactor type="Small"/>
</supportedFormFactors>
</targetConfig>
</targetConfigs>
</LightningComponentBundle>