cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AFE2E
Regular Visitor

Base64 string and JSON format

Good afternoon, 

 

On the last screen of my Powerapp, I submit data from the previous screens using a flow. The user can take photos in the app, which are saved in to a collection as base64 strings. If I don't take a photo, my JSON payload looks like the image below. All fields etc are in the correct place.

AFE2E_0-1627481556176.png

However, if I take one photo and save it to the collection before submitting the payload, it completely changes my JSON schema, as below...

 

AFE2E_1-1627481726356.png

 

The code to submit the JSON is below... The line that seems to mess it up is in the Attachments table 'documentBase64: CameraPhotos.Base64String,'

 

ForAll(
    Gallery4.AllItems,
    Collect(
        SubmitAuditRequest,
        {
            results: [
                {
                    questionKey: Value(lblQKey.Text),
                    successCriteriaMet: txtQSCM.Text,
                    addToActionPlan: false,
                    additionalComments: txtQComments.Text,
                    typeCode: lblQTypeCode.Text,
                    additionalQuestionText: lblQAdditionalQuestionText.Text,
                    score: txtQGrade.Text,
                    actions: [
                        {
                            parentKey: Value(lblQKey.Text),
                            parentTypeCode: "RECORD_PARENT_TYPE_##3",
                            action: txtQActions.Text,
                            dateRequired: txtQActionDue.Text,
                            assignedToKey: LblQUserKey.Text,
                            statusCode: "ACTION_STATUS_TYPE_##1",
                            priorityCode: "PRIORITY_TYPE_##3"
                        }
                    ],
                   
                    attachments: [
                        {
                            parentKey: Value(lblQKey.Text),
                            parentTypeCode: "RECORD_PARENT_TYPE_##3",
                            documentBase64: CameraPhotos.Base64String,
                            name: "New Image",
                            extension: "img",
                            attachmentTypeCode: "RECORD_DOCUMENT_TYPE_##1"
                        }
                    ]
                }
            ],
            organisationKey: userSettings.OrganisationKey,
            name: "TestAudit",
            typeCode: AuditTypeCode,
            statusCode: "AUDIT_STATUS_TYPE_##1",
            auditors: LearningWalk.StaffLead,
            auditDate: Text(
                Today(),
                "yyyy-mm-dd"
            ),
            staffLeadList: LearningWalk.StaffLead,
            areas: LearningWalk.Location,
            staffList: LearningWalk.StaffNames,
            focusArea: LearningWalk.Focus,
            focusSubArea: SubAreaArray,
            successCriteria: LearningWalk.SuccessCriteria,
            comment: LearningWalk.Comments,
            Key: 0,
            userKey: LearningWalk.CreatedBy,
            IsActive: true
        }
    );
    
);

Can anyone assist me?

 

Thanks in advance.

 

1 ACCEPTED SOLUTION

Accepted Solutions
RusselThomas
Microsoft
Microsoft

Hi @AFE2E ,

How are you submitting this information to Power Automate, and how is the Flow configured to receive information from PowerApps?

On the face of it, it looks like the row data is being submitted as a string - are you intending to pass a JSON construct of your full collection to Flow, or the result of a single row lookup (or something)?

Kind regards,

RT

View solution in original post

2 REPLIES 2
RusselThomas
Microsoft
Microsoft

Hi @AFE2E ,

How are you submitting this information to Power Automate, and how is the Flow configured to receive information from PowerApps?

On the face of it, it looks like the row data is being submitted as a string - are you intending to pass a JSON construct of your full collection to Flow, or the result of a single row lookup (or something)?

Kind regards,

RT

Hi

 

Thanks, I managed to work it out in the end. I didn't want to pass as a string...that's where the issue was.

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (1,802)