Skip to content

Retrieving Worklog Data

JustOn retrieves the worklogs from Jira via the Jira REST API using a chain of queueable Apex jobs. JustOn retrieves new and updated worklogs first. After that, it retrieves the deleted worklogs and deletes the corresponding records in Salesforce as well.

You can control the worklog retrieval manually or using a scheduled job.

Upon execution, you can monitor the status of the queueable jobs via the Apex job queue. To do so, look for the Apex classes UpsertWorklogManager and DeleteWorklogManager.

The user who has triggered the refresh receives an email upon completion. The email includes statistics about the refreshed worklogs and periods, and, if applicable, also error messages.

Manually Retrieving Worklogs

You can manually retrieve or refresh worklog from the Worklogs list view.

  1. Open the Worklogs tab, and select the list view All.

    The list view Recently Viewed does not display the Refresh button.

  2. Click Refresh.

  3. Select the intended Jira connection.
  4. Specify a start date.

    • Leaving the start date empty retrieves all worklogs.
    • Setting a start date in the past retrieves the worklogs starting from this date.
  5. Click Start.

    This starts the worklog retrieval.

Scheduling Worklog Retrieval

You can set up a job in order to have worklogs automatically retrieved on a regular basis.

To schedule the worklog retrieval, you can use either Salesforce's Schedule Apex functionality or the Salesforce Developer Console. For details, see Scheduling a Job.

Via Salesforce's Schedule Apex functionality:

  1. In Setup, open Apex Classes.

    In Salesforce Lightning, navigate to Custom Code > Apex Classes.

    In Salesforce Classic, navigate to Develop > Apex Classes.

  2. Click Schedule Apex on top of the list.

  3. Specify the details as required.

    • Job Name: The name of the Jira connection setting (see Defining Jira Connection Setting)
    • Apex Class: ScheduledRefreshWorklogs
    • Frequency: Weekly or Monthly (with an according weekday or day of month setting)
    • Start
    • End
    • Preferred Start Time
  4. Click Save.

    This sets up the worklog retrieval to be executed at the specified time.

Via the Salesforce Developer Console:

  1. Open the Developer Console.

    For details, see Open the Developer Console in the Salesforce Help.

  2. Execute the following code

    JOJC1__ScheduledRefreshWorklogs.setupSchedule(name, schedule);
    

    where name is the name of the Jira connection setting (see Defining Jira Connection Setting) and schedule is a cron expression.

    This sets up the worklog retrieval to be executed at the specified time.

For more details about job scheduling, see Scheduling a Job in the JustOn documentation and Schedule Apex in the Salesforce Help.