# Before script FAIL

**URL:** <https://developer.sailpoint.com/discuss/t/before-script-fail/28921>\
**Category:** SHF Discussion and Questions\
**Tags:** rules, sailpoint-identity-security\
**Created:** [February 5, 2024, 2:44pm UTC](https://developer.sailpoint.com/discuss/t/before-script-fail/28921 "2024-02-05T14:44:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gsierra](https://avatars.discourse-cdn.com/v4/letter/g/d2c977/32.png) [@gsierra](https://developer.sailpoint.com/discuss/u/gsierra)\
**Post date:** [February 5, 2024, 2:44pm UTC](https://developer.sailpoint.com/discuss/t/before-script-fail/28921/1 "2024-02-05T14:44:49Z")

</div>

Hello everyone

I am trying to update the sAMAccountName attribute of AD with a before powershell script.  
Everything works fine, but for some reason the provisioning plan is not being updated and the attribute is not changing its value.  
Running the same code directly from the rule without calling the script works correctly.  
Any idea what’s going on?

Thanks

---

<div class="post-metadata">

**Author:** ![gbagari](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/gbagari/32/5282_2.png) [@gbagari](https://developer.sailpoint.com/discuss/u/gbagari)\
**Post date:** [February 6, 2024, 8:08am UTC](https://developer.sailpoint.com/discuss/t/before-script-fail/28921/2 "2024-02-06T08:08:33Z")

</div>

@gsierra : Can you let me know how are you adding sAMAccountName name to before rule?

You can use services standard before provisioning rule from IdentityNow Mock project to add attributes in provisioning plan during before provisioning rule either in arguments (to later fetch in connectorbeforerule or add as a attribute sAMAccountName directly when needed.

Thanks.

---

<div class="post-metadata">

**Author:** ![gsierra](https://avatars.discourse-cdn.com/v4/letter/g/d2c977/32.png) [@gsierra](https://developer.sailpoint.com/discuss/u/gsierra)\
**Post date:** [February 6, 2024, 2:12pm UTC](https://developer.sailpoint.com/discuss/t/before-script-fail/28921/3 "2024-02-06T14:12:41Z")

</div>

I am following the steps mentioned in the article:  
[https://community.sailpoint.com/t5/IdentityNow-Connectors/IdentityNow-IQService-Administrator-s-Guide-vJune-2021/ta-p/77773](https://community.sailpoint.com/t5/IdentityNow-Connectors/IdentityNow-IQService-Administrator-s-Guide-vJune-2021/ta-p/77773)

The part of the code that updates the attribute is:

# Loop through the attributes from the request

foreach ($attribute in $requestObject.AttributeRequests){  
if($attribute.Name -eq “description”){  
$attribute.value = “my description”; #change value of the attribute  
}  
}

It doesn’t throw any errors, but it doesn’t update the attribute.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/sailpoint/original/2X/f/f2136700ed5e3703e0b85e02f6be799dacca7735.png) [@system](https://developer.sailpoint.com/discuss/u/system)\
**Post date:** [April 6, 2024, 2:13pm UTC](https://developer.sailpoint.com/discuss/t/before-script-fail/28921/4 "2024-04-06T14:13:06Z")

</div>

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