Wednesday 28 May 2014

Show ASPX Grid inside IFrame in MSCRM 2011

Today I am going to show one interesting thing that i have recently done in MSCRM. Hope it will help someone in any scenario.

Recently I got one requirement to call one of the web service (Search API), which will return number of Customer records stored in other Database(Not in MSCRM DB) based on some input like Name, Email ID, Mobile No, Head of Family, State etc.
Then Select only one record(actual record) from the number of records and create Contact of the same in MSCRM.

Visual Representation of Requirement :








Implementation in MSCRM:

APPROACH ?
We should use grid inside Contact form which will contain Fields to take Input Search Parameter and Grid to show searched record provided by 'Search API'.
Show Aspx Page inside MSCRM Contact form would be the best approach to do this task.Do you have any other optimize approach for the same it would be welcomed

WHY this Approach ?
We cannot do this task using MSCRM itself. Since to show searched record coming from API, we need to store in MSCRM DB first without storing in DB it is not possible to show in MSCRM platform either in Sub Grid or in Grid. Because both itself a Entity in MSCRM.
Data coming from API might contains multiple records for entered Input parameter, some of records might be useless. For Example - i have searched 'Arpit' as name. 'a@gmail.com' as EmailID, '8787874785' as Mobile No etc, it might possible API return 5 records for the same. but among 5 record only 1 record is mine and rest of records are useless, so there is no need to keep these record in MSCRM DB

Step 1:   Create I Frame in Contact Form. Host C# Web Application in IIS and give URL inside I Frame.Make sure 'Restrict Cross-Form Scripting' must be unchecked to avoid aspx page redirect to another window as shown below:
























Step 2:  Click on Search Button from Ribbon, aspx Grid inside I Frame will get highlighted. Type Input Parameter to search Customer Record




Step 3: Select Customer Record


















Step 4: Create Contact of selected Record 





Cheersssssssss :) :)

No comments:

Post a Comment

Blogger Widgets