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 / Update a CRM Record (s...
Power Automate
Unanswered

Update a CRM Record (salesorder) when a Document is uploaded to Sharepoint via CRM

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Following is the case

 

We have Sharepoint integrated with Dynamics 365. 

Sales person created an order is CRM and uploads a document against the Order in CRM. 

We want a mechanism to trigger on file create/delete and update the relevant order with no of attachments against the order.

 

I am struggling to find the salesorder identifier (GUID) so i can update the record on file created/delete.

 

Secondly, is there a way to find how many files are available in Sharepoint for each CRM Record (salesorder)?

 

Thank you

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

    Hi @Anonymous,

     

    Could you please share a screenshot of the configuration of your flow?

    Could you please share more details about your scenes?

     

    Please share more details about your scenes so we could try to provide a proper workaround for you.

     

     

    Best regards,

    Alice

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Duplicated Response

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Duplicated Response

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Scenario - A Salesperson creates an order in CRM against a Customer (Acccount). The Order is considered as complete only when the Work Order is attached/uploaded against the order. So we suggested to create a custom field (whole number) "No of Attachment" on SalesOrder entity to manage the number of attachments against the order. We are open to new suggestions.

     

    Following are the configurations

    Dynamics CRM 365 Online 

    Sharepoint Online

    Folder Path - account/AccountName/salesorder/SalesOrderName_SalesOrderGuid/

    Eg. 

    account/Chambers of Sample/salesorder/ORD-36762-Ch303-Chambers of Sample_A18F392C6D20E811A95600224800375D/

     

    Document Location contains the following info

    Relative URL - SalesOrderName_SalesOrderGuid

    Eg. ORD-36762-Ch303-Chambers of Sample_A18F392C6D20E811A95600224800375D

    Regarding - Lookup field that Contains the SalesOrderId (Guid)

     

    Current Flow Setup

    We used two variables 

    FolderName - Relative URL for the Attachment

    No of Attachments - to retrieve the current attachment count from SalesOrder

     

    Step:1

    Trigger - When a file is created

    Step:2-3

    Intialise Variables

    Step:4

    Split the Folder Path by '/' (Folder path is Dynamic Content from Step:1)

    [
      "account",
      "Chambers of Sample",
      "salesorder",
      "ORD-36762-Ch303-Chambers of Sample_A18F392C6D20E811A95600224800375D",
      ""
    ]

    Step:5

    Set FolderName by assigning the 4th Array Element

    "ORD-36762-Ch303-Chambers of Sample_A18F392C6D20E811A95600224800375D"

    Step:6

    List of Records 

    Find Top 1 Document Location by Relative URL. This record contains the SalesOrderId (Guid) as Regarding.

    Step:7

    Get the SalesOrder Record by Regarding (Step:6)

    Step:8

    Assign the SalesOrder's "No of Attachment" to the local varilable

    Step:9

    Increment the local variable by 1

    Step:10

    Update the SalesOrder with "No of Attactment" (local variable)

     

    This solution is working fine as expected. But I am looking for an alternative to search for number of attachment against the order rather than incrementing the count by 1. 

    Another issue, when a file is delete, we are not able to reduce the number by 1 as the body of the trigger contains very minimum info as below  

     {
      "ID": 7888,
      "Name": "07",
      "FileNameWithExtension": "07.JPG",
      "DeletedByUserName": "Admin User",
      "TimeDeleted": "2018-06-11T17:28:19Z",
      "IsFolder": false
    }

     

    Screenshot 1Screenshot 1Screenshot 2Screenshot 2Screenshot 3Screenshot 3

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 March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 598

#2
Valantis Profile Picture

Valantis 477

#3
Vish WR Profile Picture

Vish WR 370

Last 30 days Overall leaderboard