function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ross McLeod 3Ross McLeod 3 

Community Launched Approval process

Hi all

We're just starting out on developing a salesforce application and I've got a use case I'd like some advice on.

We have a requirement where the business would like to have a form on a community page which will allow customers to upload a document to which will then go to the user who owns the customer record.

I believe I can accomplish this in the following way:

* Create a custom object for the document (Registration Form)
* Fields on the object - Customer (Lookup, to relate to customer), Status (Picklist, with values submitted, approved, rejected)
* Allow related files and notes for the object
* Create the approval process which I'd like to be submitted from the customer and be sent to the owner on the customer record and for the approval/rejected to go back to the customer.
* Ideally I'd also like to set up a chatter notification as well
* Other icing on the cake would be to have the approval process kicked off automatically when the customer uploads the document rather than them have to click the submit for approval

First of all does this sound like I've got the right idea, there are plenty of examples for approvals coming from staff to managers but few that I've found where its from a community user?

If so how do I get to the owner of the customer record when setting up the approval process?

Is it possible to run this process automatically when the file is submitted?

Many thanks for any advice you can give?
Best Answer chosen by Ross McLeod 3
ShirishaShirisha (Salesforce Developers) 
Hi Ross,

Yes,if you would like to create an input field to upload a file then you can use the apexLfileInput.Please find the sample code in the below document.

Reference:https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_inputFile.htm

Otherwise,if you would like  to upload the file using the lightning component then you can use lightning:fileupload.Please find the sample component:

https://developer.salesforce.com/docs/component-library/bundle/lightning:fileUpload/documentation

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Warm Regards,
Shirisha Pathuri

All Answers

ShirishaShirisha (Salesforce Developers) 
Hi Ross,

Greetings!

Yes,you can create custom Object and create all the custom fields that you need to be filled by the customer along with the file uload.

Once,you have created the metadata then you will have to create the visualforce page or lightning component to create the form on community to access the inputs and create the records salesforce.

Simple VF page as form code:https://developer.salesforce.com/forums/?id=906F0000000BZqkIAG

Also,yes you can get the customer owner if by pulling the value of CreatedBy field or OwnerId.

You can also check,whether the customer has uploaded the file or not and based on which you can automate the process.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
Ross McLeod 3Ross McLeod 3
Hi Shirisha

Thanks for the response, sorry for the delayed reply. 

Just for clarities sake, I've been looking at the lighning components available from Salesforce. I can see that there is a FileInput and a FileUpload. It looks like if I want to create the object at the same time as the file then I'd have to create an APEX controller to do this and use the fileinput control rather than the upload one?

Kind regards

Ross
ShirishaShirisha (Salesforce Developers) 
Hi Ross,

Yes,if you would like to create an input field to upload a file then you can use the apexLfileInput.Please find the sample code in the below document.

Reference:https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_inputFile.htm

Otherwise,if you would like  to upload the file using the lightning component then you can use lightning:fileupload.Please find the sample component:

https://developer.salesforce.com/docs/component-library/bundle/lightning:fileUpload/documentation

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
This was selected as the best answer
Ross McLeod 3Ross McLeod 3
Hi Shirisha

Many thanks for that, it will help a lot.

Ross