web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Make a record in CRM f...
Power Automate
Answered

Make a record in CRM from a JSON file

(0) ShareShare
ReportReport
Posted on by 35

Hi All,

 

I am new in power automate. But the task I have is not trivial. So I have a bunch of files uploaded to onedrive. These are JSONs. Each json has a list of fields. looks like this:

{
"Fields": [
{
"FieldName": "Field1",
"FieldLabel": "File count",
"IsNull": false,
"ReadOnly": false,
"SystemField": true,
"Item": 1,
"ItemElementName": "Int"
},
{
"FieldName": "STOREDATETIME",
"FieldLabel": "Store Date",
"IsNull": false,
"ReadOnly": false,
"SystemField": true,
"Item": "/Date(1590068955000)/",
"ItemElementName": "DateTime"
},
{
"FieldName": "ZAHLUNGSZIEL",
"FieldLabel": "Zahlungsziel",
"IsNull": true,
"ReadOnly": false,
"SystemField": false,
"ItemElementName": "Date"
},
{
"FieldName": "DOCSIZE",
"FieldLabel": "Document Size",
"IsNull": false,
"ReadOnly": false,
"SystemField": true,
"Item": 16290480,
"ItemElementName": "Int"
}
],
"Flags": {
"IsCold": false,
"IsDBRecord": false,
"IsCheckedOut": false,
"IsCopyRightProtected": false,
"IsVoiceAvailable": false,
"HasAppendedDocuments": false,
"IsProtected": false,
"IsDeleted": false,
"IsEmail": false
},
"Links": [
{
"rel": "self",
"href": "/folder1/file7"
}
],
"Sections": [],
"ContentType": "application/pdf",
"HaveMoreTotalPages": false,
"HasTextAnnotation": false,
"HasXmlDigitalSignatures": false,
"AnnotationsPreview": false,
"TotalPages": 1,
"Id": 7,
"Title": "IMG_3827",
"LastModified": "/Date(1590068955000)/",
"LastModifiedSpecified": true,
"CreatedAt": "/Date(1590068955000)/",
"CreatedAtSpecified": true,
"FileSize": 16290480,
"SectionCount": 1,
"IntellixTrust": "None",
"VersionStatus": "Initial",
"FileCabinetId": "aaasss-dddfff-ggghhh"
}
 
The problem is that I have about 49 fields (the example is cut) and all these fields has different types, some are 'int' some are 'string'. 
 
I used Parse JSON action with this schema:

{
"type": "object",
"properties": {
"Fields": {
"type": "array",
"items": {
"type": "object",
"properties": {
"FieldName": {
"type": "string"
},
"FieldLabel": {
"type": "string"
},
"IsNull": {
"type": "boolean"
},
"ReadOnly": {
"type": "boolean"
},
"SystemField": {
"type": "boolean"
},
"Item": {
"type": "any"
},
"ItemElementName": {
"type": "string"
}
},
"required": [
"FieldName",
"FieldLabel",
"IsNull",
"ReadOnly",
"SystemField",
"ItemElementName"
]
}
},
"Flags": {
"type": "object",
"properties": {
"IsCold": {
"type": "boolean"
},
"IsDBRecord": {
"type": "boolean"
},
"IsCheckedOut": {
"type": "boolean"
},
"IsCopyRightProtected": {
"type": "boolean"
},
"IsVoiceAvailable": {
"type": "boolean"
},
"HasAppendedDocuments": {
"type": "boolean"
},
"IsProtected": {
"type": "boolean"
},
"IsDeleted": {
"type": "boolean"
},
"IsEmail": {
"type": "boolean"
}
}
},
"Links": {
"type": "array",
"items": {
"type": "object",
"properties": {
"rel": {
"type": "string"
},
"href": {
"type": "string"
}
},
"required": [
"rel",
"href"
]
}
},
"Sections": {
"type": "array"
},
"ContentType": {
"type": "string"
},
"HaveMoreTotalPages": {
"type": "boolean"
},
"HasTextAnnotation": {
"type": "boolean"
},
"HasXmlDigitalSignatures": {
"type": "boolean"
},
"AnnotationsPreview": {
"type": "boolean"
},
"TotalPages": {
"type": "integer"
},
"Id": {
"type": "integer"
},
"Title": {
"type": "string"
},
"LastModified": {
"type": "string"
},
"LastModifiedSpecified": {
"type": "boolean"
},
"CreatedAt": {
"type": "string"
},
"CreatedAtSpecified": {
"type": "boolean"
},
"FileSize": {
"type": "integer"
},
"SectionCount": {
"type": "integer"
},
"IntellixTrust": {
"type": "string"
},
"VersionStatus": {
"type": "string"
},
"FileCabinetId": {
"type": "string"
}
}
}
 
I have modified it a bit, you can see it in bold. After that I need to update the Dynamics CRM record, so that all the fields in Custom Entity are set according to JSON.
 
 

Untitled.png

 

But I stuck. I don't know how should I iterate 

Categories:
I have the same question (0)
  • Verified answer
    v-bacao-msft Profile Picture
    Microsoft Employee on at

     

    Hi @rdobryanskyy ,

     

    You can use the JSON with the most complete field to generate the schema. If the field type may be multiple, you can set the field type to multiple types.

    Please check this article to get more details on how to use Parse JSON action:

    http://johnliu.net/blog/2018/6/a-thesis-on-the-parse-json-action-in-microsoft-flow

     

    For setting fields to multiple types, you can refer to this article below.

    https://blog.thenetw.org/2019/03/11/quick-fix-microsoft-flow-error-invalid-type-expected-string-but-got-null/

    https://powerusers.microsoft.com/t5/Building-Flows/Parsing-JSON-Response-error-quot-message-quot-quot-Invalid-type/td-p/301536

     

    Best Regards,

  • rdobryanskyy Profile Picture
    35 on at

    Thanks the articles was very helpful. What I also have discovered, that for the setting the fields into the record I build that kind of flow:

     

    get JSON -> Create a CRM record -> Parse JSON -> Switch based on the FIELDS with multiple cases.

     

    Keep in mind that one switch can contain 25 cases max.

     

    Thanks

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 921

#2
Valantis Profile Picture

Valantis 801

#3
Haque Profile Picture

Haque 588

Last 30 days Overall leaderboard