AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 07.06.2011, 20:07   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
Hi all,

I am primarily working on supporting integrations between NAV and CRM using the new connector for Microsoft Dynamics. One of the most business needs one the customer sites I am actually working is to get the next no out of the NAV number series tables for using it in primary keys (resp. setup tables).

There is more than one way to solve this, but I want to you show you how easily you can do this by using the Microsoft Dynamics Connector SDK.

Requirements
  • Visual Studio (Standard, Professional - Express is also possible but needs some workarounds to extract the files) ; Language C#
  • Microsoft Dynamics Connector SDK
    Microsoft Dynamics Connector (and all the software stuff around it )
  1. Start Visual Studio and select a new project of type Class Library
  2. Add a reference to the Microsoft.Dynamics.Integration.Mapping.dll (you can find it in the installation folder of the connector)
  3. Use the existing class and setup the requirements you like my sample (if you are using standard or higher edition of visual studio you an also install the templates of the SDK)
-// code starts here //


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using Microsoft.Dynamics.Integration.Mapping;

namespace MyCustomFunctions

{

[MappingHelper]

public class MappingFunctions : LocalizedMappingHelper

{

[MappingFunction (Description="Get No from NAV NoSeries")]

[MappingFunctionCategory(Category = "NAV specific")]

} }
-// code ends here //
  • Open Microsoft Dynamics NAV Classic Client (you will need developer permission to follow my steps)
  • Create a new Codeunit and a new function GetNextNo. We will use one argument (NoSeriesCode) and one return value (NextNo)
Note: The reason for creating a new custom Codeunit instead of using 396 NoSeriesManagement is, that the not supported format of the default codeunit.
  • Write a simple NAV code to get the next number
-// code starts here //


EXIT(NoSeriesManagement.GetNextNo(NoSeriesCode,TODAY,TRUE));
-// code ends here //


  • Close, Save and Compile the Codeunit
  • Moving on to the web service form (810) and create a new web service for your Codeunit

  • Open the Internet Explorer and navigate to your web service. Copy your web service url. We will use this service to get the next no.

  • Return to your visual studio project and add a web reference to your Codeunit

  • Now we will write our custom function to use it within the connector client.
-// code starts here //


using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using Microsoft.Dynamics.Integration.Mapping;

namespace MyCustomFunctions

{

[MappingHelper]

public class MappingFunctions : LocalizedMappingHelper

{

[MappingFunction (Description="Get No from NAV NoSeries")]

[MappingFunctionCategory(Category = "NAV specific")]

public static string GetNextNo(string NoSeriesCode)

{

NAV_NoSeriesManagement.NoSeriesManagement cu70010 = new NAV_NoSeriesManagement.NoSeriesManagement();

cu70010.UseDefaultCredentials = true;

return cu70010.GetNextNoCustom( NoSeriesCode);

throw new NotImplementedException();

}

}

}
-// code ends here //
  • Build your solution and navigate to your output folder

  • Copy the output.dll into your MappingHelpers Folder in the Adapter installation directory

  • (Re)Start the Connector Client and select on of the fields you want to call the function – Voila




Note: This sample should not only show you how to get the next no of a number series. More or less it should help you to get more ideas what you can do with the SDK and how flexible the connector is (even or because some scenarios are not supported out of the box…at the moment)

If everything is running well the next time I will provide a CRM plugin to support integrating custom lookup fields between NAV and CRM which is not supported out of the box (at the moment)

Regards, Rene

Note This is a "FAST PUBLISH" article created directly from Rene Gayer. The information contained herein is provided as-is in response to FAQs. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. There is no warranty for integrity. (Example no specific exception handling included)- You can use this solution for free and for you own risk without warranty or support. 



Далее
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 12:17.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.