0 votes

Hi,

We are trying to setup a workflow where the same action an be triggered either using a Custom Command or from a Business Rule. The Custom Command has been written and works as expected. However, when we try and set this up to be triggered via a Business Rule triggered by the change of an AD property, we are unable to retrieve the new AD property value to use in the custom command.

So my question is, how can we reference the 'ExecuteScriptContext' of a Business Rule inside a Custom Command, if that Custom Command is called via a Business Rule? Basically, we need to use $Context.GetModifiedPropertyValue inside the Custom Command but it is empty (inside the Business Rule it isn't)

by (370 points)

1 Answer

0 votes
by (289k points)
selected by
Best answer

Hello Sam,

how can we reference the 'ExecuteScriptContext' of a Business Rule inside a Custom Command, if that Custom Command is called via a Business Rule?

There is no such possibility. Business Rules and Custom Commands executed by them have different contexts. If a property is updated by a Business Rule action, the new value of the property remains in the context of the Business Rule and cannot be used in Custom Commands executed by it.

As a workaround, you can execute your script in the Business Rule directly rather than in a Custom Command executed by the Business Rule.

Related questions

0 votes
1 answer

In most situations in Adaxes when multiple members are added or removed from a group the members are processed individually allowing business rules to run for each of them. ... a business rule to get information about the other members added with the cmdlet?

asked Mar 8 by Carl Bruinsma (120 points)
0 votes
1 answer

trying to leverage thsi script in a custom command, bu ti cannot get the parameter to pass to it. https://www.adaxes.com/script-repository/copy-group-membership-from-specified-user-s590.htm

asked Jan 24, 2022 by Derek.Axe (480 points)
0 votes
1 answer

We have a Business rule that runs after successful user creation. It creates a EULA Word doc with the username and initial password for the new user. It was originally set as a ... , and I don't believe any changes have been made to the Adaxes setup...

asked Jul 8, 2020 by johnsonua (390 points)
0 votes
1 answer

We have a business rule that will update an AD attribute when a new member is added to a group. This business rule works when we use powershell commands or the admin console ... set to trigger "After adding a member to a group". Thank you for your support!

asked Mar 29, 2023 by mark.it.admin (2.3k points)
0 votes
1 answer

This is a feature request. I would love to have somehwere in the service config the ability to declare PowerShell code that will be run before every custom command ... the same check during a object creation and modification that lead to code deduplication.

asked Feb 25, 2021 by Pierre (750 points)
3,550 questions
3,240 answers
8,234 comments
547,827 users