# Retrieving identity name from the task

**URL:** <https://developer.sailpoint.com/discuss/t/retrieving-identity-name-from-the-task/23935>\
**Category:** IIQ Discussion and Questions\
**Tags:** workflows, identityiq\
**Created:** [January 10, 2024, 11:06am UTC](https://developer.sailpoint.com/discuss/t/retrieving-identity-name-from-the-task/23935 "2024-01-10T11:06:11Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![AkashRaavi131](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@AkashRaavi131](https://developer.sailpoint.com/discuss/u/AkashRaavi131)\
**Post date:** [January 10, 2024, 11:06am UTC](https://developer.sailpoint.com/discuss/t/retrieving-identity-name-from-the-task/23935/1 "2024-01-10T11:06:11Z")

</div>

### Which IIQ version are you inquiring about?

Version 8.2

### Share all details related to your problem, including any error messages you may have received.

How can we retrieve the identity name for the triggered workflow using hql .

I have triggered a joiner event and i am creating a custom report using datasource Hql with columns identityName, Joiner Event name, status . I need to get the name of the identity , joiner event name for which the identity is triggered and completion status of the task (i.e. Success or Fail).

the Query i used is :

from name,completionStatus from Taskresult where name LIKE ‘D%’

I am getting the name of the task and the status . how can we get name of the identity for which it is triggered.

I am getting the above result for that i need to get name of the Identity.

---

<div class="post-metadata">

**Author:** ![abartkowski](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/abartkowski/32/23007_2.png) [@abartkowski](https://developer.sailpoint.com/discuss/u/abartkowski)\
**Post date:** [January 10, 2024, 11:44am UTC](https://developer.sailpoint.com/discuss/t/retrieving-identity-name-from-the-task/23935/2 "2024-01-10T11:44:09Z")

</div>

[IdentityIQ Object Model and Usage.pdf](https://developer.sailpoint.com/discuss/uploads/short-url/8IS1Vz4sIB5rDKuKVxbRwEeZ6Zn.pdf) (1.2 MB)

In the attached document, you will find diagrams that include the relationships between individual objects in the database.

---

<div class="post-metadata">

**Author:** ![AkashRaavi131](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@AkashRaavi131](https://developer.sailpoint.com/discuss/u/AkashRaavi131)\
**Post date:** [January 10, 2024, 1:26pm UTC](https://developer.sailpoint.com/discuss/t/retrieving-identity-name-from-the-task/23935/3 "2024-01-10T13:26:40Z")

</div>

ok ,Thanks@abartkowski . can you provide any sample hql query on relationship between objects like relationship between identity and link object.

---

<div class="post-metadata">

**Author:** ![Jarin\_James](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/jarin_james/32/3372_2.png) [@Jarin\_James](https://developer.sailpoint.com/discuss/u/Jarin_James)\
**Post date:** [January 10, 2024, 1:43pm UTC](https://developer.sailpoint.com/discuss/t/retrieving-identity-name-from-the-task/23935/4 "2024-01-10T13:43:10Z")

</div>

Hi @AkashRaavi131 ,

If you are referring to the SQL query you can use the following.

```auto
select name,completion_status,launcher from identityiq.spt_task_result where name like 'D%';

```

**launcher** is the column which holds the information who triggered the task.

---

<div class="post-metadata">

**Author:** ![AkashRaavi131](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@AkashRaavi131](https://developer.sailpoint.com/discuss/u/AkashRaavi131)\
**Post date:** [January 10, 2024, 2:14pm UTC](https://developer.sailpoint.com/discuss/t/retrieving-identity-name-from-the-task/23935/5 "2024-01-10T14:14:11Z")

</div>

can you provide hql query for the above mentioned column names and i need to get the name of the identity also as a column

---

<div class="post-metadata">

**Author:** ![iamksatish](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/iamksatish/32/26217_2.png) [@iamksatish](https://developer.sailpoint.com/discuss/u/iamksatish)\
**Post date:** [January 10, 2024, 2:40pm UTC](https://developer.sailpoint.com/discuss/t/retrieving-identity-name-from-the-task/23935/6 "2024-01-10T14:40:48Z")

</div>

@AkashRaavi131  
Are you looking for identity name of the user on which the joiner triggered?

Can you provide the sample xml of task result you are querying.

---

<div class="post-metadata">

**Author:** ![Jarin\_James](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/jarin_james/32/3372_2.png) [@Jarin\_James](https://developer.sailpoint.com/discuss/u/Jarin_James)\
**Post date:** [January 10, 2024, 3:03pm UTC](https://developer.sailpoint.com/discuss/t/retrieving-identity-name-from-the-task/23935/7 "2024-01-10T15:03:21Z")

</div>

Hi @AkashRaavi131 ,

It should be something like below.

```auto
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE TaskDefinition PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<TaskDefinition executor="sailpoint.reporting.LiveReportExecutor" name="Task Status Report" progressMode="Percentage" resultAction="Rename" template="true" type="LiveReport">
  <Attributes>
    <Map>
      <entry key="report">
        <value>
          <LiveReport title="Task Status Report">
            <DataSource type="Hql">
              <Query>from TaskResult where name LIKE 'D%'</Query>
            </DataSource>
            <Columns>
              <ReportColumnConfig field="name" header="Name" property="name" sortable="true" width="110"/>
              <ReportColumnConfig field="completionStatus" header="Completion Status" property="completionStatus" sortable="true" width="110"/>
              <ReportColumnConfig field="launcher" header="Launcher" property="launcher" sortable="true" width="110"/>
            </Columns>
          </LiveReport>
        </value>
      </entry>
      <entry key="reportTitle" value="Task Status Report"/>
    </Map>
  </Attributes>
  <RequiredRights>
    <Reference class="sailpoint.object.SPRight" name="FullAccessEntitlementRequestStatusReport"/>
  </RequiredRights>
</TaskDefinition>

```

---

<div class="post-metadata">

**Author:** ![HemantSingh](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/hemantsingh/32/6737_2.png) [@HemantSingh](https://developer.sailpoint.com/discuss/u/HemantSingh)\
**Post date:** [January 10, 2024, 5:57pm UTC](https://developer.sailpoint.com/discuss/t/retrieving-identity-name-from-the-task/23935/8 "2024-01-10T17:57:12Z")

</div>

TaskResult have the traget\_name and traget\_id which is identity name and identity id but target name is not mapped so you need to join TraskResult and Identity table on id and targetId and then get the identity name from the identity table. see the HQL below whihc should work for your requirement.

```auto
select i.name,r.name,r.completionStatus from TaskResult r, Identity i where r.targetId = i.id and r.name like 'JOINER FEATURE FOR%'

```

---

<div class="post-metadata">

**Author:** ![AkashRaavi131](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@AkashRaavi131](https://developer.sailpoint.com/discuss/u/AkashRaavi131)\
**Post date:** [January 10, 2024, 5:59pm UTC](https://developer.sailpoint.com/discuss/t/retrieving-identity-name-from-the-task/23935/9 "2024-01-10T17:59:07Z")

</div>

Exactly this is the xml of the task i have written , but here the name of the identity is not coming . the result csv file i have provided.  
[samplereport.csv](https://developer.sailpoint.com/discuss/uploads/short-url/vLKb8D0NCNNtsjdYqiyLquEU4mC.csv) (1.9 KB)  
in that i need to get the name of the identity in sperate column along with name of the event and completionStatus.

---

<div class="post-metadata">

**Author:** ![AkashRaavi131](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@AkashRaavi131](https://developer.sailpoint.com/discuss/u/AkashRaavi131)\
**Post date:** [January 11, 2024, 4:42am UTC](https://developer.sailpoint.com/discuss/t/retrieving-identity-name-from-the-task/23935/11 "2024-01-11T04:42:01Z")

</div>

yes, I am looking for the identity name of the user on which the joiner triggered.  
The sample xml I am using :  
[sample.txt](https://developer.sailpoint.com/discuss/uploads/short-url/1xTqPGx7adyhR3PV3zeQrwBIrZI.txt) (1.1 KB)

---

<div class="post-metadata">

**Author:** ![Jarin\_James](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/jarin_james/32/3372_2.png) [@Jarin\_James](https://developer.sailpoint.com/discuss/u/Jarin_James)\
**Post date:** [January 11, 2024, 5:40am UTC](https://developer.sailpoint.com/discuss/t/retrieving-identity-name-from-the-task/23935/12 "2024-01-11T05:40:10Z")

</div>

HI @AkashRaavi131 ,

Sorry, for the confusion. The query which I shared earlier will give the launcher of the workflow/task not the identity for it triggered.

In the spt\_task\_result table, we have couple of columns target\_name and target\_id which you can query to get the target users. But for Joiner events these values will will be null. In this case you can extract the identity name from task name using render script like below.

```auto
<ReportColumnConfig field="joinerName" header="JoinerName" property="name" sortable="true" width="110">
  <RenderScript>
     <Source>
       String joiner = value.substring(27);
       return joiner;
    </Source>
  </RenderScript>
</ReportColumnConfig>

```

Ideally speaking, it should by creating a report on Audit Events.

---

<div class="post-metadata">

**Author:** ![AkashRaavi131](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@AkashRaavi131](https://developer.sailpoint.com/discuss/u/AkashRaavi131)\
**Post date:** [January 11, 2024, 7:10am UTC](https://developer.sailpoint.com/discuss/t/retrieving-identity-name-from-the-task/23935/13 "2024-01-11T07:10:05Z")

</div>

Hi @Jarin_James  
Can you please provide the complete xml code.

I have got the above mentioned error " could not extract ResultSet"  
and I also provided the xml code that i have written.  
[Reportxmlfile.txt](https://developer.sailpoint.com/discuss/uploads/short-url/wvt93KvIctsfhiM9tcbf03jqwkA.txt) (1.6 KB)

 ![error](https://global.discourse-cdn.com/sailpoint/original/2X/1/18c2f8af0f0b74885b0949d6e65fd63038829e44.png)  
 ![Screenshot (56)](https://global.discourse-cdn.com/sailpoint/original/2X/d/defda927a0770e5b685525eb5bc4bb5d785f71d3.png)

---

<div class="post-metadata">

**Author:** ![Jarin\_James](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/jarin_james/32/3372_2.png) [@Jarin\_James](https://developer.sailpoint.com/discuss/u/Jarin_James)\
**Post date:** [January 11, 2024, 9:14am UTC](https://developer.sailpoint.com/discuss/t/retrieving-identity-name-from-the-task/23935/14 "2024-01-11T09:14:14Z")

</div>

Can you try with this?  
[Reportxmlfile.txt](https://developer.sailpoint.com/discuss/uploads/short-url/6wrrEqUombQ73OLkZ5d3OdnYg4j.txt) (1.4 KB)

---

<div class="post-metadata">

**Author:** ![AkashRaavi131](https://avatars.discourse-cdn.com/v4/letter/a/47e85d/32.png) [@AkashRaavi131](https://developer.sailpoint.com/discuss/u/AkashRaavi131)\
**Post date:** [January 11, 2024, 10:04am UTC](https://developer.sailpoint.com/discuss/t/retrieving-identity-name-from-the-task/23935/15 "2024-01-11T10:04:53Z")

</div>

I am getting the below error:

sailpoint.tools.GeneralException: sailpoint.tools.GeneralException: The application script threw an exception: java.lang.StringIndexOutOfBoundsException: begin 27, end 24, length 24 BSF info: script at line: 0 column: columnNo  
at sailpoint.api.DynamicValuator.evaluate(DynamicValuator.java:404)  
at sailpoint.reporting.datasource.DataSourceColumnHelper.runColumnRenderer(DataSourceColumnHelper.java:57)  
at sailpoint.reporting.datasource.BaseProjectionDataSource.getFieldValue(BaseProjectionDataSource.java:250)  
at sailpoint.reporting.JasperCsvWriter.write(JasperCsvWriter.java:118)  
at sailpoint.reporting.LiveReportExecutor.execute(LiveReportExecutor.java:275)  
at sailpoint.api.TaskManager.runSync(TaskManager.java:909)  
at sailpoint.api.TaskManager.runSync(TaskManager.java:724)  
at sailpoint.scheduler.JobAdapter.execute(JobAdapter.java:128)  
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)  
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)

---

<div class="post-metadata">

**Author:** ![HemantSingh](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/hemantsingh/32/6737_2.png) [@HemantSingh](https://developer.sailpoint.com/discuss/u/HemantSingh)\
**Post date:** [January 11, 2024, 12:37pm UTC](https://developer.sailpoint.com/discuss/t/retrieving-identity-name-from-the-task/23935/16 "2024-01-11T12:37:04Z")

</div>

The code below does the substring from 27th position to end of the string what happens if value is null or void or its less than 27 characters and these are cases where the below code will through exception

```auto
String joiner = value.substring(27);

```

you can change the above line to

```auto
  if(value != void &amp;&amp; value !=null &amp;&amp; value.length()>=27){
      return value.substring(27);
  }else {
    return value;
}

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [March 11, 2024, 12:37pm UTC](https://developer.sailpoint.com/discuss/t/retrieving-identity-name-from-the-task/23935/17 "2024-03-11T12:37:07Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
