Tips & Tricks - Using your OneDrive filename input to specify or create the path where it should be stored

If you have fiddled with the OneDrive provider at all, you will have noted that you have two main entity (or path) options - myfiles and shared along with their extended path options, ie shared/EmployeeFun.

However, this is usually specified upfront in your YAML.
But, did you know that you can also specify additional paths using only the filename input field from mobile?

Let’s assume that a user has access to a jig where they can add images to a OneDrive folder called EmployeeFun. Within OneDrive this folder has several employee events listed as folders underneath.

When you set it up as per the below code sample and you provide a filename, it will save to the specified path.

title: Share your pics
type: jig.default
description: Share your pics for all to access!

actions:
  - children: 
      - type: action.submit-form
        options: 
          title: Submit
          provider: DATA_PROVIDER_ONEDRIVE
          entity: shared/EmployeeFun
          method: create
          formId: Images
          goBack: stay
          data: 
            tokenType: jigx.graph.oauth
              
          onSuccess: 
            title: Create Successful

        
children:
  - instanceId: Images
    options:
      children:
        - instanceId: fileName
          options:
            label: Image Title
          type: component.text-field
        - instanceId: file
          options:
            label: Add your Image(s)
            mediaType: image
          type: component.media-field
    type: component.form

You can also use the mobile app to save files directly to any of the nested folders, or in this case the TeamBuilding2023 folder.

To do so, you can access the jig on mobile and instead of just adding a filename like in the first image below, you can now also specify an additional path it should be saved to. In this example, it would now save to shared/EmployeeFun/TeamBuilding2023 instead of shared/EmployeeFun.

You can also use the same logic to create a path or folder that does not yet exist and it would create that path for you instead.

For this example (third image), we have created a new separate folder in the TeamBuilder2023 folder for the Red Team. The image is ultimately then saved to this path: shared/EmployeeFun/TeamBuilding2023/Red Team

2 Likes