-
Notifications
You must be signed in to change notification settings - Fork 36
Query Resources
The Query Resources configuration of a WAL activity allows you to construct a query using XPath Search Filter dialect and read any attributes of any Resource Objects in FIM / MIM.
The Queries defined can be referenced by their name ("Key") in source value expressions or as targets using lookups with the [//Queries/Key/...]
grammar. e.g. [//Queries/Terminations/Manager]
for consumption in a source value expression or [//Queries/Terminations/Description]
for consumption in a target lookup for mass update as shown in the screen shot below:
The queries can be referenced in the Activity Execution Condition and as the collection to do Iteration over.
An activity can configure more than one queries. In that case, the queries are executed in the order they are defined. Data from the first query could also be used in the filter criteria for the second query providing for the ability to further refine the result set. If the first query returns multiple or no results instead of a single result, you need to ensure that the second query constructed is still a valid FIM XPath Filter grammar. A valid query can be constructed using WAL function expression syntax as explained in the XPath Search Filter Wiki.
As of build v2.16.0130.0, WAL supports defining a "collection" of queries as a single named query. The below is an example where the xEmail text attribute of a custom target resource which stores a multi-line text file of email addresses (to be updated to the group that it references) is used to define a collection query named "MembersToAdd":
Key | XPath Filter |
MembersToAdd | /FormatMultivaluedList("/Person[Email = '{0}']", SplitString([//Target/xEmail])) |
Since the queries get executed before the Activity Execution Condition is evaluated, care must be taken to ensure that query expressions result in a well-formed FIM XPath filter dialect syntax under all data conditions. A great example that demonstrates this guidance is mentioned in MIMWAL Issue #102
The following Update Resources activity adds the members to a group on the creation event of a custom resource representing the upload of a multi-line text file of email addresses.
Activity Display Name | Add Users from uploaded csv to the Group's membership | ||
Queries | |||
Key | XPath Filter | ||
Group | /Group[ObjectID = '[//Target/xGroup/ObjectID]'] | ||
MembersToAdd | /FormatMultivaluedList("/Person[Email = '{0}']", SplitString([//Target/xEmail])) | ||
Value Expression | Target | Allow Null | |
InsertValues([//Queries/MembersToAdd]) | [//Queries/Group/ExplicitMember] |
- MIMWAL Site - http://aka.ms/MIMWAL
- MIMWAL Releases - http://aka.ms/MIMWAL/Releases
- MIMWAL Documentation Wiki - http://aka.ms/MIMWAL/Wiki
- MIMWAL FAQ - http://aka.ms/mimwal/faq
- MIMWAL GitHub Code Repo - http://aka.ms/MIMWAL/Repo
- MIMWAL TechNet Q&A Forum (now read-only) - http://aka.ms/MIMWAL/Forum