How to store the time in minutes in asset?

Hello all,

How to store the time in minutes in asset in UiPath??

For example: I want to store the asset value as 5 minutes for time 10 minutes for some cases and 20 minutes for some cases ,so I dont wanna change the code again and again, so I need to configure in asset, please help on this.

To store time values in minutes as assets in UiPath and use them dynamically in your workflows, follow these steps:

1. Create the Asset in Orchestrator

  • Navigate to your UiPath Orchestrator.
  • Go to Assets and create an asset (e.g., ProcessingTime).
  • Set the value as the desired time in minutes (e.g., 5, 10, or 20).

2. Retrieve the Asset in Your Workflow

  • Use the Get Asset or Get Orchestrator Asset activity in your workflow to retrieve the asset value.
    • Specify the asset name you created in Orchestrator.
    • Store the retrieved value in a variable, e.g., processingTimeString.

3. Convert the Asset Value to an Integer

  • Use an Assign activity to convert the string asset value to an integer:
    processingTime = CInt(processingTimeString)
    
    Here, processingTime is an integer variable.

4. Use the Value Dynamically

  • Use processingTime wherever needed in your workflow. For example, if you need to wait for the specified time:
    • Use a Delay activity and set the duration to:
      TimeSpan.FromMinutes(processingTime)
      

Example Workflow:

  1. Get Asset → Retrieve ProcessingTime.
  2. Assign → Convert string to integer (processingTime = CInt(processingTimeString)).
  3. Delay → Use TimeSpan.FromMinutes(processingTime).

Advantages:

  • Centralized configuration in Orchestrator eliminates the need to modify code repeatedly.
  • You can adjust the time values on the fly by updating the asset value in Orchestrator.

If you’d like a sample workflow for this, let me know!

In delay activity, how to mention that minutes??

In the Delay activity in UiPath, you need to provide a TimeSpan object to specify the delay duration. To use minutes dynamically, follow these steps:

Steps to Configure Delay with Minutes

  1. Create or Retrieve the Time in Minutes

    • If you already have the minutes stored in an integer variable (e.g., processingTime), you can proceed.
  2. Use the TimeSpan in Delay

    • In the Delay activity’s Duration property, use the following expression:

      TimeSpan.FromMinutes(processingTime)
      
    • Here:

      • processingTime is the integer variable containing the number of minutes you retrieved from the asset.

Example:

If processingTime is 5, the Delay activity will pause for 5 minutes.

Complete Example for Dynamic Delay

  1. Retrieve Asset
    Use the Get Asset activity to fetch the asset value (e.g., 5 minutes) and store it in a string variable, processingTimeString.

  2. Convert to Integer
    Use an Assign activity:

    processingTime = CInt(processingTimeString)
    
  3. Configure Delay
    Add a Delay activity and set the Duration property to:

    TimeSpan.FromMinutes(processingTime)
    

This approach makes the delay duration completely dynamic and configurable from Orchestrator.