Answered by:
Call external web service

Question
-
Hi,
My client has a number of existing systems that we are trying to port functionality into CRM. It is clear that some of these systems will have to run in parallel for a while until we get there.
I have been asked to identify how best we can interface with these existing systems from CRM.
My automatic respose was web services. For example, the client has a database that holds a list of registered users. I have created a web form that creates a new account in CRM using CRM web services. I also created a plugin on account create that runs a query against a database to see if the user exists. At the moment we have a copy of the database/table that stores the users on same server as CRM. Rather than run the query can i simply update the plugin to call a web service that access the master database that hold a list of registered users?
I have a number of systems that will need to integrate with CRM and they will be on different servers.
What do i need to be aware of when communicating across servers/domains?
Also, can i call web service from custom workflow i have created?
Wednesday, September 15, 2010 2:12 PM
Answers
-
Hi
- You can integrate external systems using IFrames in CRM.
- YES you can call web service from both plugin's and workflows but you will need to allow for authentication and security.
A Sample code to invoke external web sites in IFrames
Please follow the steps as mention :
IFrame Properties
1. src = about:blank
2. uncheck the Restrict Cross-Frame Scription in the Security Section
3. Uncheck Pass record object-type code and unique identifier as parameters
On Load() Event: Put the below line of code in onload event.
assuming the Iframe name = IFRAME_youIframeName. Please change it accordingly.1. First Check the Form is in Edit Mode (By default the attribute values are blank)
if(crmForm.FormType == 2) // Is the user updating an existing record
{
crmForm.all.IFRAME_youIframeName .src = "http://www.abccompany.com/profile.aspx?firstname =" + escape(crmForm.all.firstname.DataValue) + "&lastname=" + escape(crmForm.all.lastname.DataValue);
}Make sure you Save and publish the entity. To test the funcionality.
Hope this helps. Amar- Marked as answer by Donna EdwardsMVP Saturday, September 18, 2010 3:29 PM
Wednesday, September 15, 2010 2:22 PM -
yes you can access webservice through your plugin/custom workflow code
Mahain : http://mahenderpal.wordpress.com- Marked as answer by Donna EdwardsMVP Saturday, September 18, 2010 3:29 PM
Wednesday, September 15, 2010 2:24 PMModerator -
So for your criteria, register a plugin in update method which consumes your external webservice and handles your code logic.
Register your plugin in update event so that your custom logic will be invoked when any attribute value is changed.
NOTE: Ensure to use ILMERGE to merge and your customer service dll to bind as a single dll to be registered in MS CRM if you want your code logic to be handled in offline.
Refer
ILMERGE TOOL:
Packaging Plugins – Binding DLL
http://crm.georged.id.au/post/2008/02/22/Packaging-plugins.aspx
- Marked as answer by Donna EdwardsMVP Saturday, September 18, 2010 3:30 PM
Wednesday, September 15, 2010 3:39 PM -
If want to do something on change event of attribute before record is saved, then you need to use client side eventhandler. You can use plug-in on update message but it will be executed only after "Save" option from form is selected.
Thank you.
JayshriP
Thank You JayshriP- Marked as answer by Donna EdwardsMVP Saturday, September 18, 2010 3:30 PM
Thursday, September 16, 2010 9:07 AM
All replies
-
Hi
- You can integrate external systems using IFrames in CRM.
- YES you can call web service from both plugin's and workflows but you will need to allow for authentication and security.
A Sample code to invoke external web sites in IFrames
Please follow the steps as mention :
IFrame Properties
1. src = about:blank
2. uncheck the Restrict Cross-Frame Scription in the Security Section
3. Uncheck Pass record object-type code and unique identifier as parameters
On Load() Event: Put the below line of code in onload event.
assuming the Iframe name = IFRAME_youIframeName. Please change it accordingly.1. First Check the Form is in Edit Mode (By default the attribute values are blank)
if(crmForm.FormType == 2) // Is the user updating an existing record
{
crmForm.all.IFRAME_youIframeName .src = "http://www.abccompany.com/profile.aspx?firstname =" + escape(crmForm.all.firstname.DataValue) + "&lastname=" + escape(crmForm.all.lastname.DataValue);
}Make sure you Save and publish the entity. To test the funcionality.
Hope this helps. Amar- Marked as answer by Donna EdwardsMVP Saturday, September 18, 2010 3:29 PM
Wednesday, September 15, 2010 2:22 PM -
yes you can access webservice through your plugin/custom workflow code
Mahain : http://mahenderpal.wordpress.com- Marked as answer by Donna EdwardsMVP Saturday, September 18, 2010 3:29 PM
Wednesday, September 15, 2010 2:24 PMModerator -
Hi,
Thanks for your reply. When creating my custom workflow or plugin i can make use of C#, intellisene and visual studio to call the web service?
If i wanted to call an external web service when an attribute is updated I would have to do that using JScript in the OnChange event of attribute or is there another way?
Thanks in advance.
Wednesday, September 15, 2010 3:27 PM -
So for your criteria, register a plugin in update method which consumes your external webservice and handles your code logic.
Register your plugin in update event so that your custom logic will be invoked when any attribute value is changed.
NOTE: Ensure to use ILMERGE to merge and your customer service dll to bind as a single dll to be registered in MS CRM if you want your code logic to be handled in offline.
Refer
ILMERGE TOOL:
Packaging Plugins – Binding DLL
http://crm.georged.id.au/post/2008/02/22/Packaging-plugins.aspx
- Marked as answer by Donna EdwardsMVP Saturday, September 18, 2010 3:30 PM
Wednesday, September 15, 2010 3:39 PM -
If want to do something on change event of attribute before record is saved, then you need to use client side eventhandler. You can use plug-in on update message but it will be executed only after "Save" option from form is selected.
Thank you.
JayshriP
Thank You JayshriP- Marked as answer by Donna EdwardsMVP Saturday, September 18, 2010 3:30 PM
Thursday, September 16, 2010 9:07 AM -
Have you had a look at the SDK? I think you will find many of your answers and most likely additional information that will help you with 'general' type, how to, questions.
Saturday, September 18, 2010 3:32 PM