Need API to get the count of approvals pending with owner

Which IIQ version are you inquiring about?

Version 8.3

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

Hello All,

Having one requirement where need to get the approval workitem count which is pending with the current owner his/her bucket.

Need REST API for this, reason we have some unified portal where we need to show this count.

Not getting out of the box API where will get only count of pending approval workitem.

can someone suggest any solution and steps?

You might not be able to achieve this via OOTB apis however, there are few ways to achieve this

  1. You could create a custom workflow that accepts the manager name (and/or workitem name) and returns the number of pending workitems for the same.

Abd then utilise the OOTB SCIM api to launch a workflow.

  1. Create a REST plugin that provides an endpoint and based on the input (manager name and/or workgroup), fetches the pending workitem and returns it in a json format.

Please keep in mind to make sure that you add authorization on top of the rest endpoints via capabilities and sprights so that only allowed identities can call the endpoint.

1 Like

Thanks for the response @Abhisinha89 .

Let me develop the rest plugin to achieve this requirement.

Thanks,
Akshay

There you go
communityrestapi.1.0.zip (77.4 KB)
you have to grant to the proxy user communityRoleRESTAllow sp_right and than you can use postman to count approvals,

Hey Hello @kjakubiak,

Thanks for your input, While importing this plugin, getting below error.

ERROR https-jsse-nio-8443-exec-5 sailpoint.plugin.PluginInstaller:263 - An error occurred during plugin installation
sailpoint.tools.GeneralException: Invalid object name ‘DUAL’.

Could you please support on this?

Thanks,
Akshay

Actually, I am using the MS SQL database, This database query is not supported

SELECT 1 FROM DUAL;

Can you support to modify this so that i can import this plugin successfully.

Thanks,
Akshay

Hi @akshay1,

Can you try SELECT 1;.

Unlike Oracle, SQL Server does not require a dummy table like DUAL to select a constant.

Thanks

Hello @ashutosh08 ,

I performed below steps:

  1. Unziped the plugin.
  2. I tried to make the changes in below files
    db > install > install.sqlserver > removed this query
    db > uninstall > uninstall.sqlserver > removed this query
    db > upgrade > upgrade.sqlserver > removed this query
  3. Again converted plugin folder .zip
  4. Tried to import the plugin.

But it is giving error “unable to locate the manifest file”.

I think i need to make the changes in plugin project and then using the ant build i need to compile this plugin.

But i don’t have source code of this.

Could you please support on this?

Thanks,
Akshay

There should be actually no DB files in this plugin as they are not required - I just build new version of the plugin - try this one
communityRestAPI.1.0.zip (15.2 KB)

1 Like

Hi @akshay1,

Are you manually extracting and performing the steps?

As for plugin installation you should simply import this zip and IIQ will take care of the rest.

Please take look on the below document for your reference.

Thanks

Thank you @kjakubiak , Let me check and i will update you the progress.

Thanks,
Akshay

Hello @kjakubiak ,

Wonderful, Congratulations champ.

It is successful. Thanks for your support.

Could you please share the logic of restAPI? if possible and if it is allowed.

Appreciate your kind support, Once again thank you!

Thanks,
Akshay

The whole plugin will be published in CoLab - waiting for approval from Sailpoint and it will be there open source, there are couple of more usefull endpoints which can be used and new ones are being created :slight_smile:

The method you are using has the following content

 @GET
    @Path("/Approvals")
    @Produces(MediaType.APPLICATION_JSON)
    public Response countApprovals(@QueryParam("identity") String identityIdOrName) throws GeneralException {
        log.debug("Counting approvals");
        initConfig();
        log.debug("Config initiated");
        log.debug("Identity: " + identityIdOrName);
        Identity identity = context.getObject(Identity.class, identityIdOrName);
        log.debug("Identity: " + identity);
        QueryOptions qo = new QueryOptions();
        qo.addFilter(Filter.eq("owner.id", identity.getId()));
        log.debug("QueryOptions: " + qo);
        Gson gson = new GsonBuilder().setPrettyPrinting().create();
        Map<String, Integer> returnMap = new HashMap<>();
        Integer counter = context.countObjects(WorkItem.class, qo);
        log.debug("Counter: " + counter);
        returnMap.put("total", counter);
        log.debug("ReturnMap: " + returnMap);
        return Response.status(200).entity(gson.toJson(returnMap)).build();
    }

Here is very early version of documentation for the plugin
Doc.zip (114.2 KB)

1 Like

Thank you @kjakubiak

Hello @kjakubiak,

It is not giving count if the request is pending with any workgroup.

Please find below example.

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