locked
Plugins for Online Version RRS feed

  • Question

  • So after spending hours working on plugins and not having much success with examples I went to  the documentation in the SDK.  It states in the Introduction to the Event Framework, last full paragraph:

    "The Event Framework is only supported only on the Microsoft Dynamics CRM server and the Microsoft Outlook client. For more information abouthow to extend the Microsoft Dynamics CRM Web application, see Customize Microsoft Dynamics CRM."

    Is this a true statement and does it apply to a user who is using the Web Application online?  I was able to get the AccountNumberPlugin and FollowupPlugin samples to work online in the Web Application but am really struggling to find some consistancy in registering plugins and documentation on what should be the settings for the registration tools when Creating Steps.

    Thanks in Advance,

    LLB


    WeDoMapping
    Tuesday, January 17, 2012 3:28 PM

Answers

  • Plugins are supported by CRM Online. The only requirement when registering the plugin in CRM Online is that it should be registered in Sandbox mode. This means it cannot access external file system objects.

    Besides that any plugin designed for CRM On-Premise works on CRM Online.

    If you could provide further details on what your plugin does and issues you are facing we might be able to assist you better.

    Sam


    Dynamics CRM MVP | Inogic | http://inogic.blogspot.com| news at inogic dot com

    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    • Proposed as answer by Sam - Inogic Wednesday, January 18, 2012 12:38 AM
    • Marked as answer by WeDoMapping Thursday, January 19, 2012 6:41 PM
    Wednesday, January 18, 2012 12:38 AM

All replies

  • CRM online is essentially a CRM server hosted in the cloud. For this reason, plugin works for CRM Online. 

    Hope this helps. 


    Daniel Cai | http://danielcai.blogspot.com | Follow @danielwcai
    Tuesday, January 17, 2012 7:28 PM
  • Plugins are supported by CRM Online. The only requirement when registering the plugin in CRM Online is that it should be registered in Sandbox mode. This means it cannot access external file system objects.

    Besides that any plugin designed for CRM On-Premise works on CRM Online.

    If you could provide further details on what your plugin does and issues you are facing we might be able to assist you better.

    Sam


    Dynamics CRM MVP | Inogic | http://inogic.blogspot.com| news at inogic dot com

    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    • Proposed as answer by Sam - Inogic Wednesday, January 18, 2012 12:38 AM
    • Marked as answer by WeDoMapping Thursday, January 19, 2012 6:41 PM
    Wednesday, January 18, 2012 12:38 AM
  • Ok here goes.  I am working with the leads entity, my create plugin works just fine!  My update is not working.  I  made this simple one to test what was going on:

     

    '''''''''''''''''''''''''THIS WORKS
    Public Sub Execute(serviceProvider As System.IServiceProvider) Implements Microsoft.Xrm.Sdk.IPlugin.Execute
            Dim context As Microsoft.Xrm.Sdk.IPluginExecutionContext =
                  CType(serviceProvider.GetService(
                          GetType(Microsoft.Xrm.Sdk.IPluginExecutionContext)), 
                      Microsoft.Xrm.Sdk.IPluginExecutionContext)
    
            ' The InputParameters collection contains all the data passed in the message request.
            If context.InputParameters.Contains("Target") AndAlso
                TypeOf context.InputParameters("Target") Is Entity Then
    
                Dim entity As Entity = CType(context.InputParameters("Target"), Entity)
                If entity.LogicalName.Equals("lead") Then
    
                    Dim sAddress As String = ""
                    If entity.Attributes.Contains("address2_line1").Equals(False) Then
                        sAddress = entity("address2_line1")
                    End If
    
                    entity("address2_city") = entity("address2_line1")
                    Dim sCity As String = ""
                    If entity.Attributes.Contains("address2_city").Equals(False) Then
                        sCity = entity("address2_city").ToString
                    End If
                    ''Dim sState As String = ""
                    ''If entity.Attributes.Contains("address2_stateorprovince").Equals(False) Then
                    ''    sState = entity("address2_stateorprovince").ToString
                    ''End If
    
                    Dim sZip As String = ""
                    ''If entity.Attributes.Contains("address2_postalcode").Equals(False) Then
                    ''    sZip = entity("address2_postalcode")
                    ''End If
                    Dim sCountry As String = ""
                    ''If entity.Attributes.Contains("address2_country").Equals(False) Then
                    ''    sCountry = entity("address2_country")
                    ''End If
    
                    ''If entity.Attributes.Contains("description").Equals(False) Then
                    ''    entity("description") = sAddress & " " & sCity & " " & sState & " " & sZip & " " & sCountry
                    ''End If
                End If
    
    
            End If
        End Sub
        
        ''''''''''''THIS DOES NOT WORK, Just uncommented the Stateorprovince code
        
            Public Sub Execute(serviceProvider As System.IServiceProvider) Implements Microsoft.Xrm.Sdk.IPlugin.Execute
                Dim context As Microsoft.Xrm.Sdk.IPluginExecutionContext =
                      CType(serviceProvider.GetService(
                              GetType(Microsoft.Xrm.Sdk.IPluginExecutionContext)), 
                          Microsoft.Xrm.Sdk.IPluginExecutionContext)
        
                ' The InputParameters collection contains all the data passed in the message request.
                If context.InputParameters.Contains("Target") AndAlso
                    TypeOf context.InputParameters("Target") Is Entity Then
        
                    Dim entity As Entity = CType(context.InputParameters("Target"), Entity)
                    If entity.LogicalName.Equals("lead") Then
        
                        Dim sAddress As String = ""
                        If entity.Attributes.Contains("address2_line1").Equals(False) Then
                            sAddress = entity("address2_line1")
                        End If
        
                        entity("address2_city") = entity("address2_line1")
                        Dim sCity As String = ""
                        If entity.Attributes.Contains("address2_city").Equals(False) Then
                            sCity = entity("address2_city").ToString
                        End If
                        Dim sState As String = ""
                        If entity.Attributes.Contains("address2_stateorprovince").Equals(False) Then
                            sState = entity("address2_stateorprovince").ToString
                        End If
        
                        Dim sZip As String = ""
                        ''If entity.Attributes.Contains("address2_postalcode").Equals(False) Then
                        ''    sZip = entity("address2_postalcode")
                        ''End If
                        Dim sCountry As String = ""
                        ''If entity.Attributes.Contains("address2_country").Equals(False) Then
                        ''    sCountry = entity("address2_country")
                        ''End If
        
                        ''If entity.Attributes.Contains("description").Equals(False) Then
                        ''    entity("description") = sAddress & " " & sCity & " " & sState & " " & sZip & " " & sCountry
                        ''End If
                    End If
        
        
                End If
        End Sub
        
        
    

     and here is the error I am getting:

     

    Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Unexpected exception from plug-in (Execute): SimplePlugin.UpdateLeadvb: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.Detail:
    <OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
      <ErrorCode>-2147220956</ErrorCode>
      <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
      <Message>Unexpected exception from plug-in (Execute): SimplePlugin.UpdateLeadvb: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.</Message>
      <Timestamp>2012-01-18T21:31:01.5796019Z</Timestamp>
      <InnerFault i:nil="true" />
      <TraceText>

    [SimplePlugin: SimplePlugin.UpdateLeadvb]
    [d40cffae-0242-e111-854b-1cc1dee89a7f: SimplePlugin.UpdateLeadvb: Update of lead]


    </TraceText>
    </OrganizationServiceFault>

    and here are my settings for the Step:

     

     

    I have verified the address2_stateorprovince is valid on the lead form.  Any help or direction would be greatly appreciated, lost a lot of time today.

     

    Thanks in advance.

    LLB

     


    WeDoMapping
    • Edited by WeDoMapping Wednesday, January 18, 2012 10:31 PM
    Wednesday, January 18, 2012 10:30 PM
  • So I got my answer for supported online, but can someone look at my above code and tell me what I am doing wrong, or show me a simple update for a lead entity?
    WeDoMapping
    Saturday, January 21, 2012 3:03 PM
  • Sorry for the late reply, I have been very occupied in the recent days. 

    The problem that you are currently experiencing is a very typical CRM issue. When CRM performs an update, it will only post the fields to the server that have been changed on the interface. In other word, if a field has not been changed from the UI, the field value will not be in the property bag even though it has a value on the interface.

    The solution for this kind of problem is to use Pre Image entity. To use Pre Image entity, you need to add it in CRM plugin registration tool, where you can add a pre image for the step, and specify which fields that you want to be included in the image entity. Pre Image can be thought as a snapshot of the CRM entity before the changes. 

    Hope this helps. Please let us know if you need further assistance. 


    Daniel Cai | http://danielcai.blogspot.com | Follow @danielwcai

    Sunday, January 22, 2012 1:03 PM