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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Canvas patch and a pos...
Power Apps
Unanswered

Canvas patch and a post operation plugin issue

(0) ShareShare
ReportReport
Posted on by 4

Hi all,

 

I am writing a canvas app as a companion to our CRM.  When entity A is created in the web version of the CRM, there is a post operation synchronous plugin that fires which creates child entities of entity A.

 

In the canvas app, I am also creating an entity A using a Patch statement.  After the entity A is created via the patch in the canvas app, I need to update the child records of the entity.

 

My problem is I think the patch function is returning before all of the child records are created because I am unable to find them after the patch statement.

 

Has anyone experienced this or have any advice?

 

Thanks.

Categories:
I have the same question (0)
  • C-Papa Profile Picture
    1,836 on at

    Hi, are you able to post your code? i don't know of any issue doing operations like this, it's probably a code issue 

  • spiderbear Profile Picture
    4 on at

    Hi C-Papa,

     

    Below is the code I am using.  The colLipInspections collection contains some lip inspections that were created when the app was offline.  This code runs when the app is online again.  So I want to create the lip inspections online using the data stored offline.  When the lip inspection record is created, a post operation sync plugin runs which creates the child station records.  The next part of the code is where I am trying to update the child records with the offline child station data.  However, the child records don't seem to be there online when the patch creating the lip inspections returns in the app.  Hope that makes sense.

     

    ClearCollect(colTempLipInspId, {OnlineLipInspID: "", OfflineLipInspID: ""});
    
    ForAll(
     Filter(colLipInspections, CreatedOffline = true),
     Collect(colTempLipInspId, 
     {OnlineLipInspID: Patch('Inspections (Lip)', Defaults('Inspections (Lip)'), 
     {'Inspection Date': cqms_inspection_date, 
     'Operating At': LookUp('Mine Sites', 'Mine Site' = OperatingAtMineSiteGUID),
     'Operating Machine': LookUp(Machines, Machine = OperatingMachineGUID),
     Lip: LookUp(Lips, Lip = LipGUID)
     } ).'Inspection (Lip)', OfflineLipInspID: LipInspectionGUID} 
     );
    );
    
    ForAll(colTempLipInspId,
     ForAll(Filter(colLipInspectionStationItemsNose, LipInspectionGUID = GUID(OfflineLipInspID)),
     UpdateIf('Station Items (Lip Inspection)', 'Lip Inspection'.'Inspection (Lip)' = GUID(OnlineLipInspID)
     && Station = ThisRecord.Station && 'Station Type' = ThisRecord.'Station Type' 
     && 'Action Item'.'Action Item' = ThisRecord.'Action Item'.'Action Item'
     ,
     {'Current Profile': cqms_tip_profile,
     'Recommended Wear': cqms_recommended_wear, 
     'Replace?': cqms_replace,
     'Locking Kit Action': cqms_locking_kit_action,
     'Additional Notes': cqms_additional_notes,
     sys_top_wear_base64: cqms_sys_top_wear_base64,
     sys_side_wear_base64: cqms_sys_side_wear_base64,
     sys_shroud_base64: cqms_sys_shroud_base64,
     'Shroud Image': cqms_shroud_image,
     'Top Wear Image': cqms_top_wear_image,
     'Side Wear Image': cqms_side_wear_image 
     });
     );
    );

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard