AcuWikiReplace Operator - Haufe-Lexware/haufe.no-frills-transformation GitHub Wiki
Replaces image and upload file references in Acumatica wiki content with deduplicated filenames from a lookup map.
The acuwikireplace operator processes Acumatica wiki markup content and replaces file references (images and uploads) with new filenames from a lookup map. This is useful when deduplicating or renaming wiki attachments during data migration or cleanup operations.
| Parameter | Type | Description |
|---|---|---|
| lookupMapName | String | The name of the lookup map containing the filename mappings. Must have a field named "TargetName" |
| wikiContent | String | The wiki markup content containing file references to replace |
Returns the wiki content with all matching file references replaced with their target filenames from the lookup map.
The operator recognizes and replaces two types of file references:
-
Image references:
[image:filename.png|...] -
Upload file references:
[{up}filename.pdf|...]
The lookup map must:
- Use the original filename as the key
- Have a field named
TargetNamecontaining the replacement filename - Keys are case-sensitive
OriginalName,TargetName
screenshot1.png,img_001.png
screenshot2.png,img_001.png
document.pdf,doc_001.pdf
guide.pdf,doc_002.pdf<LookupMaps>
<LookupMap name="FileDedup" keyField="OriginalName">
<Source config="delim=';'">file://file_dedup.csv"</Source>
</LookupMap>
</LookupMaps>
<Fields appendSource="true">
<Field name="Content">acuwikireplace("FileDedup", $Content)</Field>
<!-- ... -->
</Fields>| WikiContent |
|---|
| See the [image:screenshot1.png|width=500] for details |
| Download [image:screenshot2.png|thumb] and [{up}document.pdf|size] |
| Reference: [image:unknown.png|] and [{up}guide.pdf|] |
| WikiRevision |
|---|
| See the [image:img_001.png|width=500] for details |
| Download [image:img_001.png|thumb] and [{up}doc_001.pdf |
| Reference: [image:unknown.png|] and [{up}doc_002.pdf|] |
Notes:
- screenshot1.png → img_001.png (deduplicated)
- screenshot2.png → img_001.png (deduplicated to same file)
- document.pdf → doc_001.pdf
- guide.pdf → doc_002.pdf
- unknown.png remains unchanged (not in lookup map)
- File deduplication: Replace duplicate images/files with a single copy
- File renaming: Update all references after renaming files
- Wiki migration: Update file references when migrating between systems
- Content cleanup: Standardize file naming in wiki content
- Searches for
[image:filename|patterns in the content - Searches for
[{up}filename|patterns in the content - For each match, looks up the filename in the provided lookup map
- If found, replaces with the
TargetNamevalue - If not found, leaves the original reference unchanged
- Preserves all other wiki markup (parameters after
|)
The operator matches filenames containing:
- Letters (a-z, A-Z)
- Numbers (0-9)
- Forward slashes
/(for paths) - Backslashes
\\(for paths) - Dots
.(for extensions) - Hyphens
- - Underscores
_
- Filename matching is case-sensitive
- The lookup map must have a field named exactly
TargetName - If the lookup map doesn't exist, an exception is thrown
- File references not found in the lookup map are left unchanged
- The operator preserves all wiki formatting and parameters after the
|character - Both image and upload file references are processed in a single operation
<!-- This will throw an error if the lookup map doesn't exist -->
<Field name="Content">acuwikireplace("NonExistentMap", $Wiki)</Field>Error: AcumaticaWikiReplaceOperator: Lookup map 'NonExistentMap' does not exist.