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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 11.12.2010, 19:13   #1  
Blog bot is offline
Blog bot
Участник
 
25,497 / 847 (79) +++++++
Регистрация: 28.10.2006
Leon's CRM Musings: Auto-Numbering Using Workflow
Источник: http://leontribe.blogspot.com/2010/1...-workflow.html
==============

This is a trick one of my co-workers (Amreek Singh) showed me a little while ago. This will work in CRM 4 and CRM 2011, although, for convenience, I’m doing it in the 2011 beta.

Current Auto-Numbering Options

The first option is for a limited set of entities which have auto-numbering out of the box.



For Contracts, Cases, Articles, Quotes, Orders, Invoices and Campaigns, auto-numbering can be set in the Administrative settings in CRM. The prefix for each of the entity numbers can be set and the final suffix can be of a length from four characters to six characters. A word of warning, if you change the length of the prefix, this changes for ALL the entities, not just the one you’re on.

For other entities, if you are using CRM 4, there is also an auto-numbering plugin available from codeplex.

http://crmnumbering.codeplex.com/

Of course, if you are using the online version of CRM 4 or CRM 2011, you will need to resort to another option. Here is one using workflow.

Step One: An Entity to Store the Current Incrementing Value

To store the current value of the incrementing value, we need a new entity. For this entity we create one record to hold the values.



In this case I’m storing the prefix and the suffix I am going to use for an incrementing value on the account record.

The record also needs to have 1:N relationship to the records it will increment. In this case, the Account entity.

Step Two: Set up the Field on the ‘Numbered’ Record

Account already has an ‘Account Number’ field so I will use this field to hold the value of the field.

Step Three: Set up the Workflows

I tried doing this with one workflow but for some reason the workflow could not link to the record with the values in it and then populate them. Therefore, I’m using two. The first workflow runs on the creation of the Account record and links to the record storing the increment values.



Incidentally, there is no need to add the lookup to the Account form as workflows can populate fields whether or not they have been added to the form. This is great when you need to store values but do not want to clutter the forms up.

The second one is triggered when the link to the value store record is populated. It does the populating of the Account record and also increments the value store by one so the next Account record gets a different suffix value.



For the Account Number, we add the two ‘slugs’ divided by a dash.



For the incrementing of the storing record, I use a little known trick which is available in both versions of CRM.



When you use the Form Assistant to populate a field, drop the ‘Set To’ Operator down and you will see a whole range of different operators available, depending on the field type. In the case of integer fields, one of the options is ‘Increment By’. By adding ‘1’ to the Default Value and hitting OK we tell the workflow to increment by 1 every time the workflow fires.

What We End Up With

After all this we end up with a process which will populate the Account Number of an Account with a unique value every time an Account record is created. As usual with workflows, this runs asynchronously. In other words, you will NOT see the field populating on the initial creation but rather only after you have saved and closed the record and reopened it a little time later, after the workflows have finished.



We can extend this to multiple entities by adding other fields to the store record and setting up additional 1:N relationships from the store record entity.

Have fun!




Источник: http://leontribe.blogspot.com/2010/1...-workflow.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Leon's CRM Musings: Dynamics CRM Resources for the Rest Of Us Blog bot Dynamics CRM: Blogs 0 06.11.2010 03:11
Ошибка бизнес-процесса Tarasov E Dynamics CRM: Разработка 9 18.02.2010 14:02
Leon's CRM Musings: Auto-assigning workflow-created records to the current user Blog bot Dynamics CRM: Blogs 0 05.02.2010 15:05
CRM DE LA CREME! Configuring Microsoft Dynamics CRM 4.0 for Internet-facing deployment Blog bot Dynamics CRM: Blogs 0 18.08.2009 11:05
Microsoft Dynamics CRM Team Blog: Workflow E-mail Utilities Blog bot Dynamics CRM: Blogs 0 16.12.2008 23:05
Опции темы Поиск в этой теме
Поиск в этой теме:

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

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

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

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