Using ECMAScript to make IDM 4.5 Web Service calls

over 4 years ago
So I was browsing over the Micro Focus/NetIQ forums for a way to make a web service call to IDM 4.5 provisioning service. I found instructions in the documentation at and also a few forums have some interesting ways like

However, for small tasks like fetching requestID etc., I feel writing java code or creating PRD with integration task is rather an overhead. The maintenance of additional PRD and java class is not trivial. So came the thought that if we could leverage ECMAScript under the driver advanced setting and use it simply under the policy by calling the function using xpath and es:Function() and make call. Was this possible. The answer is yes.

To give a brief background about our use case, we had a requirement where we needed to fetch the approval workID. This is so we can generate a link and send it in an email, so the users can login and directly see their form. In the approval step of the PRD, we can use the email notification and use the $TASK_DETAILS$ token to generate such links. But as we found the email notifications sent from the PRD were not reliably sent in our case. So began our work journey into ecmascript for soap calls. The result was that we uncovered a very powerful feature of ECMAScript, which though everyone feels exists, is not very properly documented. Below is the javascript that took shape to satisfy our use case. But as you can see, this can be potentially tweaked to do almost any call to the provisioning web service.

//ECMA script


function GetWorkID()
var USERNAME = "cn=uaadmin,ou=sa,o=data";
var PASSWORD = "P@ssword01";
var url= "";
try {
//Get Stub
var ctx = new Packages.javax.naming.InitialContext();
var service =""));
var prov =;
var stub =;
stub._setProperty(, USERNAME);
stub._setProperty(, PASSWORD);
stub._setProperty(, url);
//Get workitem ID
var logic =;
var workEntryOrder =;
var workEntryqueryChoice = [3];
workEntryqueryChoice[0] = new;
workEntryqueryChoice[1] = new;
workEntryqueryChoice[2] = new;
workEntryqueryChoice[2].setProcessId("CN=TestApprovalWorkflowAJ,CN=RequestDefs,CN=AppConfig,CN=User Application Driver,CN=driverset1,O=system");
var query = new,workEntryOrder,workEntryqueryChoice);
var WorkEntryArray =, 10));
var workEntry = [];
workEntry = WorkEntryArray.getWorkentry();
return workEntry[0].getId();
catch (err) {
return "Error is: " err;

Our policy simply calls the above ECMAScript using the xpath token es:GetWorkID()

From the results of it, we are extremely happy with this ECMAScript capability and posting this so that it assists any lone wanderer who is thinking about the same things which came to our mind.


How To-Best Practice
Comment List
  • This approach was successful in IDM 4,5 and earlier versions.

    Now, with IDM 4.8 and the separation into IDMProv.war and workflow.war, the function works in Pre Activity mappings, only.

    In running workflows (e.g., Map/Log), the call to ctx.lookup() fails.

Related Discussions