following example show how to call a powershell rule from a rule / workflow (script)
Powershell rule example:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<Rule created="1727175048060" id="0a6418429222145f819223a7bb7c0589" language="beanshell" modified="1727344180848" name="createOu In powershell" type="ConnectorAfterCreate">
<Attributes>
<Map>
<entry key="ObjectOrientedScript" value="true"/>
<entry key="disabled" value="false"/>
<entry key="extension" value=".ps1"/>
<entry key="program" value="powershell.exe"/>
<entry key="timeout" value="120"/>
</Map>
</Attributes>
<Signature returnType="Map">
<Returns>
<Argument name="response"/>
</Returns>
</Signature>
<Source>
Add-type -path "D:\Program Files\IQService\\utils.dll";
$sReader = New-Object System.IO.StringReader([System.String]$end:Request);
$xmlReader = [System.xml.XmlTextReader]([Sailpoint.Utils.xml.XmlUtil]::getReader($sReader));
$requestObject = New-Object Sailpoint.Utils.objects.AccountRequest($xmlReader);
$resultObject = New-Object Sailpoint.Utils.objects.ServiceResult;
// here you need to pull variables
xxx
// here you put what ever you want to run.
</Source>
</Rule>
NOTE: in case of requestObject empty, check utils.dll path
Rule launch powershell rule
import sailpoint.object.Identity;
import sailpoint.object.EntitlementGroup;
import sailpoint.object.Identity;
import sailpoint.api.Workflower;
import sailpoint.object.Workflow;
import sailpoint.object.WorkflowLaunch;
import sailpoint.object.Filter;
import sailpoint.object.QueryOptions;
import java.util.List;
import sailpoint.object.Identity;
import sailpoint.object.Link;
import sailpoint.object.ProvisioningPlan;
import sailpoint.object.ProvisioningPlan.AccountRequest;
import sailpoint.object.ProvisioningPlan.AttributeRequest;
import sailpoint.object.ProvisioningPlan.ObjectRequest;
import sailpoint.object.ProvisioningPlan.Operation;
import sailpoint.object.QueryOptions;
import sailpoint.object.ApprovalItem.ProvisioningState;
import sailpoint.api.IdentityService;
import sailpoint.api.SailPointContext;
import sailpoint.object.Application;
import sailpoint.object.Field;
import sailpoint.object.Filter;
import sailpoint.object.Form;
import sailpoint.object.ProvisioningPlan.ObjectOperation;
import java.lang.String;
import java.util.Set;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import org.apache.log4j.Logger;
import sailpoint.object.Application;
import sailpoint.object.RpcRequest;
import sailpoint.object.RpcResponse;
import sailpoint.object.Rule;
import sailpoint.connector.RPCService;
Logger migdalogger = Logger.getLogger("migdal.iiq");
AccountRequest accountRequest = new AccountRequest();
accountRequest.setApplication("IIQ");
accountRequest.setNativeIdentity("OU=createdByIIQ,DC=migdal-dev,DC=co,DC=il");
accountRequest.setOperation(AccountRequest.Operation.Modify);
AttributeRequest attributeRequest = new AttributeRequest();
attributeRequest.setOperation(Operation.Add);
attributeRequest.setName("distinguishedName");
attributeRequest.setValue("OU=createdByIIQ,DC=migdal-dev,DC=co,DC=il");
//createOu In powershell = rule name running the PS like example above example
Rule createOUInPowershell = context.getObjectByName(Rule.class, "createOu In powershell");
String ruleInString = createOUInPowershell.getSource();
accountRequest.add(attributeRequest);
Map data = new HashMap();
data.put("Request", accountRequest);
data.put("postScript", createOUInPowershell);
// AD = Active Directory application name
Application ad = context.getObjectByName(Application.class,"AD");
data.put("Application",ad.getAttributes());
// HOST = server running IQSERVICE
RPCService service = new RPCService("HOST", 5050, false, false);
service.setConnectorServices(new sailpoint.connector.DefaultConnectorServices());
RpcRequest request = new RpcRequest("ScriptExecutor", "runAfterScript", data);
RpcResponse response = service.execute(request);