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.

Description

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.

Parameters

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

Return Value

Returns the wiki content with all matching file references replaced with their target filenames from the lookup map.

Wiki Syntax Patterns

The operator recognizes and replaces two types of file references:

  1. Image references: [image:filename.png|...]
  2. Upload file references: [{up}filename.pdf|...]

Lookup Map Requirements

The lookup map must:

  • Use the original filename as the key
  • Have a field named TargetName containing the replacement filename
  • Keys are case-sensitive

Example

Lookup Map: file_dedup.csv

OriginalName,TargetName
screenshot1.png,img_001.png
screenshot2.png,img_001.png
document.pdf,doc_001.pdf
guide.pdf,doc_002.pdf

Configuration

<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>

Input Data

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|]

Output

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)

Use Cases

  • 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

Behavior

  1. Searches for [image:filename| patterns in the content
  2. Searches for [{up}filename| patterns in the content
  3. For each match, looks up the filename in the provided lookup map
  4. If found, replaces with the TargetName value
  5. If not found, leaves the original reference unchanged
  6. Preserves all other wiki markup (parameters after |)

Pattern Matching

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 _

Notes

  • 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

Error Handling

<!-- 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.

See Also

⚠️ **GitHub.com Fallback** ⚠️