---
title: "Example 2 - Logging work as another user"
canonical: "https://support.appfire.com/space/PSJ/15487305/Example%202%20-%20Logging%20work%20as%20another%20user"
format: markdown
---
> Macro (aura-html)

get

Using Power Actions™ and the power of SIL™, you can do a lot of things with your Jira. For example, you can log work on behalf of another user.

For this, you can configure a button with a single step:

![image](media://a8bfb47a-8c08-4d1f-aeed-b4b3cb3fa65f)

The button will be always enabled and it's essentially a script asking for a confirmation that we want to log work for another user. If the answer to the confirmation question on the first screen is "yes", then the action will be enabled, otherwise the action will be disabled.

The button contains a confirmation question and on its action screen we save the selected value:

- screen script:
- action script:

The condition script for the action would look like this:

```
use "poweraction";
number ENABLED = 1;
number DISABLED = 2;
number HIDDEN = 3;

string option = getAttribute("option");
return option == "yes" ? ENABLED : HIDDEN;
```

In the screen script we configure the fields that we need to log the work:

```
use "poweraction";
setActionTitle("Log work as user");

createUserPicker("User", currentUser(), false, true, "");
createInput("Time Spent", "", false, true, "(eg 3w 4d 12h)");
createDateTimePicker("Date Started", currentDate(), false, false, "");
createRadioGroup("Remaining Estimate", {"Adjust automatically", "Use existing estimate"},"Adjust automatically", false);
createTextArea("Work Description", "", false);

setExecuteButtonText("Done");
```

In the action script we retrieve the values from the screen and add the worklog:

```
use "poweraction";
string user = getSingleValue(argv, "User");
interval timeSpent = getSingleValue(argv, "Time Spent");
date startDate = getDateValue(argv, "Date Started");
string estimate = getSingleValue(argv, "Remaining Estimate");
string comment = getSingleValue(argv, "Work Description");

if (estimate == "Adjust automatically") {
    addWorklogAdjustEstimate(key, user, timeSpent, startDate, comment);
} else {
    addWorklogExistingEstimate(key, user, timeSpent, startDate, comment);
}
```

That's it!  
  


That's how the implementation looks like in the ticket:

![image](media://4cf6b4e3-581d-4355-9bc8-e4d69542ba0e)

 

![image](media://e6d76b86-ba0a-4889-9491-42d12246436c)