Get current time for user

<< Click to Display Table of Contents >>

Navigation:  Bizagi Studio > Process wizard > Business Rules > Business rules examples >

Get current time for user

Overview

Bizagi offers a function where you can obtain the current user's time. You might need this information for such things as timers and notifications.

 

To obtain the current user's time use the following function, this will return a Date-time type with the information you need:

 

CHelper.GetCurrentTimeForUser(idUser)

 

The following attributes are needed:

idUser: The current user's ID.

 

Example

In the following sample process, assume we have a process entity called OfficeSupplyRequest.

Such process uses the following data model:

 

ProductRequestDataModel

 

The delivery date must be seven days after the request is made. For this, we will use the GetCurrentTimeForUser function to obtain the user's current date and add seven days to it. We will then set this value to the Delivery Date attribute.

 

The expression would be as follows:

 

GetCurrentUserTime_01

 

var currentDate = CHelper.GetCurrentTimeForUser(Me.Case.WorkingCredential.UserId);
var estimatedDeliveryDate = currentDate.AddDays(7);
<OfficeSupplyRequest.DeliveryDate> = estimatedDeliveryDate;

 

The expression above obtains the current user time and adds seven days to it on the estimatedDeliveryDate variable. Then sets that value to the attribute Delivery Date.