I had a business rules that had a PowerShell script to update User properties in a SQL table. It was working fine.

I moved the PowerShell to a custom command so I could use it in multiple business rules. But now the PowerShell in the custom command does get the values for the User object.

Am I missing something?

by (730 points)
by (216k points)
0

Hello,

Can you post the PowrerShell script that you use here or send it to our support e-mail (<support[at]adaxes.com>)?

by (730 points)
0

Thank you I just emailed the script

1 Answer

by (216k points)
0 votes

Hello,

The thing is that in your script, you use the $Context.GetModifiedPropertyValue method to get the values entered by users. It works in Business Rules, because Business Rules are triggered by a certain operation (creating a user or updating a user), and the values are modified or set by that operation. However, when you call a Custom Command from your Business Rule, this is a completely different operation, and it doesn't modify any values. It only runs a Custom Command. That's the reason why the $Context.GetModifiedPropertyValue method fails.

by (730 points)
0

OK, I understand. So, in my situation how can I solve my problem?

I need to run the update script only when some of the properties are modified. And I need to call this from multiple Business Rules.

Is there no way to do it other than by duplicating the script in the Business Rules?

by (216k points)
0

Could you describe in a bit more detail what task you want to achieve with the Business Rules and when are the Business Rules triggered? As far as we understand, your Rules are triggered before the main operation (e.g. before updating a user). This is not a good idea at all because if an operation fails for some reason (for example, if the initiator doesn't have sufficient access rights), the values specified by the user will not be saved to the AD, but will be saved to the SQL database anyway.

Related questions

Hello, I'm trying to execute a custom command through a Powershell script, but I'm struggling to pass multiple values to an AD Object Picker parameter. ... , $NULL, $NULL, 0) $obj.ExecuteCustomCommand($command.CommandID, $commandArguments) Thanks in advance!

asked Nov 24, 2021 by KelseaIT (330 points)
0 votes
1 answer

Is it possible to have custom command that doesn't execute on a specific (or any) AD object? I realize Adaxes is for AD management, but I was wondering if it would be ... to execute against and AD object, I just need it to talk to the SQL server. Thanks

asked Nov 9, 2012 by bemho (520 points)
0 votes
1 answer

I edited a custom attribute in Adaxes, and manually entered the value for each Org Unit. When I attemp to get that property in Adaxes, it gives me an empty value. I'm sure ... ." You can see at the bottom of the image below that this value does contain data

asked 6 days ago by apruitt (380 points)
0 votes
1 answer

Can you run a powershell to get a Custom Command's ID?

asked Jun 10, 2020 by hgletifer (1.3k points)
0 votes
1 answer

We currently have a form for HR to deal with ex-employees that are hired once more, but it's not much more than automatic emails sent to IT. If I add some actions ... this trigger the business rule we have that targets "After updating a user" ? Thanks, Louis

asked Oct 18, 2022 by lw.fa (150 points)
0 votes
1 answer