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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Sharepoint integration

(0) ShareShare
ReportReport
Posted on by 1,067

Hi All,

For Opportunity Entity I have enabled SharePoint Out of the Box integration so the user can upload attachments for the opportunities. Last month the customer added a requirement related to SharePoint, basically is to send an email when a user adds a Attachment to the Opportunity(through SharePoint).

My original idea was to create a plugin on Retrieve and Update of Opportunity, so the plugin will count the total of documents when the record is Retrieved/updated and will check if there's a difference in the total of attachments(If TotalDocuments_at_Update > TotalDocuments_at_Retrieve then trigger workflow). After some investigation I was able to retrieve the total of documents for an specific opportunity folder in the SharePoint server using Plugin/Web services, the problem started when I noticed that when a user adds an attachment there's no Update process for the opportunity, this means that if the user close the browser or just don't update anything in the opportunity the plugin on update will not be triggered and hence the validation that checks if there's a difference will not be triggered either. 

My question at this point is:  if there's a way to intercept or catch the process of uploading an attachment to SharePoint? Maybe through a function of JavaScript or something. I remember that the SharePoint window that appears when you click on Documents in the Ribbon bar is an iFrame with source pointing to the SharePoint server, but I tried to get that HTML and I could't.

Any suggestions?

Thanks in advance!

*This post is locked for comments

I have the same question (0)
  • EnriqueMdz Profile Picture
    1,067 on at

    .

  • Suggested answer
    J Matlon Profile Picture
    1,465 on at

    You could call a Web Service from javascript.

    You could go about this 3 different ways:

    1. You could create a web service call in jscript that you could add to the SharePoint upload dialog box. That web service call could update your corresponding CRM record. You'd need SharePoint Designer to be able to add jscript to this form.

    2. Since you've already built the web service call to check for documents in SharePoint. You could call that same call through jscript that fires when your CRM form is loaded. You would then update your total documents on your form load, as opposed to when a plugin fires (which doesn't happen when documents are loaded).

    3. You could also create a SharePoint solution that would call your web service when a document is loaded, similar to the way your plugin fires in CRM.

  • EnriqueMdz Profile Picture
    1,067 on at

    Hi Joe, I really appreciate your answer.

    Option 1 would not be viable since the SharePoint server is from a partner company and I have no direct access to it.

    I'm not sure if I understood Option 2, did you mean to fire the web call through JS when the Form is loaded so I can save the total of documents? If I wrote if right, the user would need to reload the Form so there could be another process that checks if there's a difference in the total of documents?

    In the case of  Option 3, how can I create a SharePoint Solution?

    Sorry for all the questions but I'm new in this topic.

    Thanks in advance.

  • Suggested answer
    J Matlon Profile Picture
    1,465 on at

    If you don't have access to the SharePoint server, the only option that works is Option 2. You would not want a SharePoint server updating your CRM if you don't own the SharePoint server.

    You could create jscript that fires on the OnLoad of the form that uses your web service to check the count of documents in your SharePoint folder, and compares it to the documents that were in that folder previously.

    This would require adding a field to your Opportunities to track the current number of documents.

    I would then recommend then calling a workflow to send your emails if this value has changed.

    There is a CodePlex solution that will make calling a workflow much easier: processjs.codeplex.com

  • Suggested answer
    DanBlake Profile Picture
    on at

    Granted this is a little late for the OP but it might help someone else.  It seems that the more straight-forward solution would have been to register a plugin on the Create event of the "sharepointdocument" entity.  The plugin code should retrieve the parent opportunity and all linked sharepointdocuments from which you can get the count.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans