Get Access Request Comments in Powershell script

Hello,

I am using After Modify Rule to trigger the Powershell script. After requesting Entitlement access, After Modify rule is triggered which contains the Requestor Comments (as per attached logs), now I need to get these comments in Powershell script.

Can anyone help on this?

Thanks.

Hi @nikhleshsdg,

Try something as below :

$sReader = New-Object System.IO.StringReader([System.String]$requestString);
$xmlReader = [System.xml.XmlTextReader]([sailpoint.utils.xml.XmlUtil]::getReader($sReader));
$requestObject = New-Object Sailpoint.Utils.objects.AccountRequest($xmlReader);
$attributesMap = $requestObject.Attributes

You can then write the value of $attributesMap to a log file to see if the comments value exist in the output.

If yes, you can call it. As I can’t see your full log file, it could be something as below or make required adjustments

$attributesMap.comments OR $attributesMap.comments.value

OR

$attributesMap.IdnAccessRequestAttributes.comments OR $attributesMap.IdnAccessRequestAttributes.comments.value

1 Like

HI @jesvin90,

Thanks for the suggestion but it did not work out. I have attached the complete log of After modify script, if you can suggest something else.

Try this:

$sReader = New-Object System.IO.StringReader([System.String]$requestString);
$xmlReader = [System.xml.XmlTextReader]([sailpoint.utils.xml.XmlUtil]::getReader($sReader));
$requestObject = New-Object Sailpoint.Utils.objects.AccountRequest($xmlReader);
$comments = $requestObject.AttributeRequests.Attributes.comments

HI @jesvin90,

Yes, it worked. thank you for your help.

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