Hello developer community,
I got this account request that I’m catching in an afterModify rule
<AccountRequest application="AD [source]" op="Modify" nativeIdentity="CN=Bus Qo,OU=Users,DC=com">
<Attributes>
<Map>
<entry key="cloudPreviousValues">
<value>
<Map>
<entry key="extensionAttribute4" value="active" />
</Map>
</value>
</entry>
</Map>
</Attributes>
<AttributeRequest op="Set" name="extensionAttribute4" value="onboarding" />
</AccountRequest>
I am only able to get the AttributeRequest (key and value) that I can put in a map.
For the others attributes within the accountRequest (like cloudPreviousValues) I cannot access it.
Here is my code `Try{
if($enableDebug) {
LogToFile(“$logDate - Entering SailPoint rule”)
}
Add-type -path “C:\SailPoint\IQService\Utils.dll”;
$sReader = New-Object System.IO.StringReader([System.String]$env:Request);
$xmlReader = System.xml.XmlTextReader;
$requestObject = New-Object Sailpoint.Utils.objects.AccountRequest($xmlReader);
$resultObject = New-Object Sailpoint.Utils.objects.ServiceResult;
$requestAsString = $env:Request
if($enableDebug) {
LogToFile("$logDate - Request as XML object is: $requestAsString")
}
$requestMap = @{}
if ($requestObject) {
foreach ($attrib in $requestObject.AttributeRequests) {
$nameAttr = $attrib.Name
$valueAttr = $attrib.Value;
LogToFile("$logDate - Request as XML object2 is: $nameAttr")
LogToFile("$logDate - Request as XML object2 is: $valueAttr")
$requestMap.Add($nameAttr,$valueAttr);
}
}
LogToFile("$logDate - Request as xmlReader : $xmlReader")
$ADID2 = Get-AttributeValueFromAccountRequest $requestObject "extensionAttribute4"
$ADID = Get-AttributeValueFromAccountRequest $requestObject "cloudPreviousValues"
$ADID0 = Get-AttributeValueFromAccountRequest $requestObject "Attributes"
#$managerMail = $requestMap['managerMail'];extensionAttribute4
#$cloudPreviousValues = $requestAsString| Select-Object -ExpandProperty Keys
LogToFile("$logDate - Request as requestMap: $requestMap")
LogToFile("$logDate - Request as ADID0: $ADID2")
LogToFile("$logDate - Request as ADID0: $ADID")
LogToFile("$logDate - Request as ADID0: $ADID0")
`
I tried to load my requestAccess object while pointing towards its attributes
$requestObject.Attributes
but I got this error : Error: Item = → Message = Exception calling “.ctor” with “1” argument(s): "AccountRequest element not found.
Do you know how if I can access those attributes ?
thanks in advance,