Power Automate流程咨询:JSON转可读PowerAutomate-Items及CRM Doc_Config值填充Word文档显示原始文本的解决方法
Doc_Config Text into Usable Data for Power Automate & Word Got it, let’s break down why your Word document is showing raw text instead of your intended data—and how to fix it quickly. The core issue is that your CRM’s Doc_Config value is being passed as plain text (even if it looks like JSON) instead of a structured object Power Automate can read and use to populate your template.
Root Cause
When you pass raw text directly to your "Convert json to readable PowerAutomate-Items" flow, Power Automate doesn’t recognize it as structured data—it just treats it as a single string. That’s why your Word doc ends up with the full raw text instead of the specific fields you want.
Step-by-Step Solutions
1. Parse the Raw Text into a Structured JSON Object
Add a Parse JSON action immediately after pulling Doc_Config from your CRM. This is the most reliable fix if your Doc_Config is valid JSON:
- Insert the
Parse JSONaction right after your CRM data retrieval step. - Set the Content field to your
Doc_Configdynamic content. - To generate the correct schema automatically:
- Copy a sample of your raw
Doc_Configtext (e.g.,{"CustomerName":"Acme Corp","OrderID":"ORD-12345"}). - Click Generate from sample in the Parse JSON action, paste the sample, and hit Done.
- Copy a sample of your raw
- Now Power Automate will show each field from the JSON as selectable dynamic content—no more raw text!
2. Map Parsed Fields to Your Word Template
Instead of feeding the raw Doc_Config string into your Word fill step, pick the specific parsed fields from the Parse JSON output. For example:
- If your Word template has a placeholder
<<CustomerName>>, map it to theCustomerNamefield from the parsed JSON, not the fullDoc_Configtext.
3. Fallback: Manual Extraction for Non-JSON Raw Text
If your Doc_Config isn’t valid JSON (e.g., it’s a custom delimited string like CustomerName|Acme Corp|OrderID|ORD-12345), use Power Automate’s string tools to extract values:
- Use the
split()function to break the text into segments:split(outputs('Get_Doc_Config')?['body'], '|')(replace|with your actual delimiter). - Use
first(),last(), orindexOf()to grab specific values:first(split(outputs('Get_Doc_Config')?['body'], '|'))to get the first segment. - Store extracted values in a Compose action for easy reuse in the Word fill step.
4. Clean Up Escaped/Extra Characters (If Needed)
Sometimes CRM adds extra quotes or escaped characters to the raw text. Use a Replace action to clean it up before parsing:
- For example, use
replace(outputs('Get_Doc_Config')?['body'], '\"', '')to remove escaped double quotes (adjust based on your specific raw text format).
Example Flow Structure
- Retrieve
Doc_Configfrom CRM (Get the raw text value) - Parse JSON (Convert text to structured data)
- Populate Word Template (Map parsed fields to placeholders)
- Finalize & Distribute Document
内容的提问来源于stack exchange,提问作者axbeit

