Skip to main content
Question

How to Validate File Name to Upload to Box from Salesforce

  • May 22, 2025
  • 6 replies
  • 32 views

Forum|alt.badge.img

Hello,

 

I currently have the Box app installed on Salesforce. The file upload works with both standard and custom objects. However, I would like to add file name validation. How may I go about doing this? Any help would be greatly appreciated.

 

Sincerely,

Anon

6 replies

Forum|alt.badge.img

Perhaps I should add more information?

 

Should I use:

  • JWT with SDK
  • JWT with API
  • OAuthentication 2.0
  • Dev Token

(Although, it looks like the documentation mentions that Dev Tokens are more for testing purposes. Please correct me if I am mistaken.)

 

Which approach would be recommended? Any assistance would be greatly appreciated.


Forum|alt.badge.img

Hello, 

 

Thanks so much for using our Platform and Development Forum! 

 

Could you please provide some more details about your use case? Are you trying to validate that the name doesn't already exist in your enterprise? 

 

Best, 

Kourtney


Forum|alt.badge.img

Hi Kourtney,

 

Thank you for your reply. We would like to make sure the file follows a naming convention before uploading (example: Hospital Bill John Doe MMDDYYYY.doc).

 

Sincerely,

Anon


Forum|alt.badge.img

Hello, 

 

Thanks so much for the clarification! 

 

You will need to write some logic to check the file name before making the API call to box. Box doesn’t care about file names as long as there’s no conflicting file name in the same directory and that the characters used are valid. For example, if you want all file names to be “# account_name date” (where # is a number and date is a date in a specific format), you need to write that logic yourself and have a way to notify the user that they need to rename the file. Unfortunately, we won't be able to provide guidance on what that specific logic should look like. 

 

Best, 

Kourtney


Forum|alt.badge.img

Hi Kourtney,

 

Thank you for your reply. So, you and your developers suggest that I use JWT with API instead of JWT with SDK or OAuthentication 2.0?

 

Sincerely,

Anon


Forum|alt.badge.img

Hello, 

 

Choosing to use an SDK or not is completely up to you and your personal preference! If you are new to using the Box API and are familiar with our of the programming languages we offer an SDK for, I would definitely suggest using one to guide you. 

 

As for whether to use standard oauth2 or JWT, that's dependant on your use case. I would recommend taking a look at the comparison chart on this page and dig a little deeper into our documentation on each to decide which is going to provide what you need!

 

Best, 

Kourtney