Tuesday, November 24, 2009

Clearing fields in Microsoft Dynamics CRM 4.0

I've used following code to clear fields (set properties of entities to null):

account acc = new account();
acc.accountid = new Key(new Guid("249FB2CF-31CD-DE11-AB59-005056B30605"));

Lookup lookup = new Lookup();
lookup.IsNull = true;
lookup.IsNullSpecified = true;

acc.primarycontactid = lookup;
crmservice.Update(acc);


This code works but there is more elegant and readable way to clear fields:

account acc = new account();
acc.accountid = new Key(new Guid("249FB2CF-31CD-DE11-AB59-005056B30605"));
acc.primarycontactid = Lookup.Null;
crmservice.Update(acc);


Similar approach also will work for CrmDateTime, CrmNumber, Picklist, Customer, CrmMoney, CrmFloat, CrmDecimal fields.

Tuesday, November 03, 2009

Custom workflow action which returns current DateTime value

Here is the code:

using System;
using System.Collections.Generic;
using System.Text;
using System.Workflow.Activities;
using Microsoft.Crm.Workflow;
using System.Workflow.ComponentModel;
using Microsoft.Crm.Sdk;
using Microsoft.Crm.Sdk.Query;
using Microsoft.Crm.SdkTypeProxy;

namespace CurrentDateTimeWorkflowStep
{
[CrmWorkflowActivity("Current Date Time", "Utiles")]
public class CurrentDateTime : SequenceActivity
{
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
Value = CrmDateTime.Now;

return base.Execute(executionContext);
}

public static DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(CrmDateTime), typeof(CurrentDateTime));

[CrmOutput("Value")]
public CrmDateTime Value
{
get
{
return (CrmDateTime)base.GetValue(ValueProperty);
}
set
{
base.SetValue(ValueProperty, value);
}
}
}
}


And here is the source project and built assembly.

Tuesday, October 20, 2009

showModalDialog and postbacks in custom aspx pages in Microsoft Dynamics CRM 4.0

I've developed a custom aspx dialogue page. It has button with postback and when this button is clicked - action is executed but new window is opened. Solution for this case is to add <base target="_self"/> tag under head tag.

Friday, September 25, 2009

Sunday, September 06, 2009

Overriding Records per page count for Microsoft Dynamics CRM 4.0

I've decided to use idea and code from one of my previous posts.

Idea:
1. Add field to user entity which will contain count of records to show.
2. Replace system-defined count of records with value from 1 trough catching and handling Execute message.

Wednesday, September 02, 2009

Supported Record Counter For Microsoft Dynamics CRM 4.0

I've already published code of record counter for Microsoft Dynamics CRM 4.0 in this post. Those record counter worked but it had some issues (lookups, advanced finds, form assistant).

I've upgraded the code and now it works perfectly.

Friday, August 21, 2009

Do you know...

How to retrieve server datetime on the client in Microsoft Dynamics CRM 4.0

I have found interesting question on Microsoft Social forum and decided to develop such customization.

I had some ideas of how to do this:
1. Create custom aspx page.
2. Create custom webservice.
3. Use standard Microsoft CRM WebServices for this task.

The first and the second ways were not interesting for me because I had already used in some tasks I'd made. So I decided to implement the third idea.

Tuesday, August 18, 2009

Отображение денежных единиц в отчётах прописью

Этот пост пишу по-русски, потому что он может быть интересен только русскоязычным читателям.

При разработке отчётов-печатных форм счёта столкнулся с необходимостью выводить величину счёта буквами (125 руб. 50 коп надо было отобразить соответственно Сто двадцать пять рублей 50 копеек). Для этого, произведя поиск, нашёл и использовал следующие функции, которые могут пригодиться и Вам. Далее код:

Tuesday, August 04, 2009

Custom workflow action which renders and sends a report for Microsoft Dynamics CRM 4.0 with email

Idea of this custom workflow action is following:
1. Give user possibility to run and export report in one action.
2. Insert this exported report as attachment into email.
3. Sent this email to recipient.

Monday, July 20, 2009

Data Import From Card Scan to Microsoft Dynamics CRM 4.0

I've developed the application which can import data from Card Scan Application to Microsoft Dynamics CRM 4.0. This product is not free ware as all my past solutions. If you are interesting in purchasing of this solution drop the comment here or send me an E-Mail to a33ik [at] bigmir [dot] net.

Here the screencast for this solution:

Friday, July 10, 2009

Plugin for copying notes and attachements from lead to contact whis is converted from lead for Microsoft Dynamics CRM 4.0

I've been asked to write plugin for following scenario:
When user converts lead to contact - all attachements and notes must be copied to retrieved contact.

Thursday, June 25, 2009

Creation of Shortcut to record in Microsoft Dynamics CRM 4.0 in Workflows

There are a lot of such tasks to create shortcut of record which had initialized a workflow execution to be used in email notifications.

Idea of realization of such functionality is not mine. Author of idea - Artem 'Enot' Grunin (Артем Enot Грунин) and I'm very appreciated to him for his bright ideas, help and criticism.

Tuesday, June 23, 2009

Data Audit Manager for Microsoft Dynamics CRM 4,0

I know that there are a lot of similar and free solutions but I decided to have this solution in my exploration portfolio.

There are a lot of codes in the article, so If somebody wants to retrieve code you should leave comment. :)

Monday, June 22, 2009

Personal Default Views Manager for Microsoft Dynamics CRM 4.0

The customer wants to make a personal setting for views according to next scenario.
Default account view is 'Active Accounts' for Tom, and 'My Active Accounts' view is default for Peter.

I've developed a little wizard and I would like to share it.

Tuesday, June 02, 2009

Offtopic.

This is video of Royal Irish Rangers Airsoft Team, Kyyiv, Ukraine. I'm from this team. I hope this video will be interesting for you.

Monday, June 01, 2009

Field Security Level For Microsoft Dynamics CRM 4.0 With Own Hands

Following article describes how to create mechanism which provides/restricts access to see fields of records in edit form/print preview/grids.

Idea:
1. Creation two custom entities - Field Security Level(contains name of entity to restrict access to fields and Business Unit for which restriction will be operate) and Field Security Level Attribute (contains Attribute Name and Bit flag - Access Allowed/Disallowed).
Field Security Level entity is parent to Field Security Level Attribute. Both entities are organization owned.
2. Field Security Level form scripting.
3. Writing a plugin which will create Field Security Level Attributes for just created Field Security Level based on entity name.
4. Writing a base class which will retrieve fields restriction for entity.
5. Writing a plugin which will handle Execute message, retrieve entity name and modify request to prevent appearance of 'forbidden' columns.
6. Writing a plugin which will handle Retrieve message, retrieve entity name and modify request to prevent appearance of 'forbidden' columns.
7. Writing a plugin which will handle RetrieveMultiple message, retrieve entity name and modify request to prevent appearance of 'forbidden' columns.

Friday, May 15, 2009

Public Views Manager For Microsoft Dynamics CRM 4.0 With Own Hands

Following article describes how to create mechanism which provides/restricts access to views of entities.

Idea:
1. Creation two custom entities - Public View Manager(contains name of entity to restrict access to views and Business Unit for which restriction will be operate) and Public View Detail (contains View Name and Bit flag - Access Allowed/Disallowed).
Public View Manager entity is parent to Public View Detail. Both entities are organization owned.
2. Public Entity Manager form scripting.
3. Writing a plugin which will create Public View Detail for just created Public View Manager.
4. Writing a plugin which will handle RetrieveMultiple message on savedquery entity and if restrictions exist - correct filter for data retrieving.

Thursday, May 14, 2009

Record count per page For Microsoft Dynamics CRM 4.0

All you know that maximal records quanity is 250. I have wrote a little plugin which increases this count to 1000.

Wednesday, May 13, 2009

Page refresh after record was changed on a server

Hi. This is my first post on English so I beg a pardon for my terrible English. My native is C#.

I think that almost all of developers for MS CRM has issues with form refreshing.
For example - child entity update trough plugin invoke update of parent entity and if form of parent entity is opened changes will be shown only after reopening or refreshing of form. To avoid this issue i wrote a little code.

Idea is following:
1. Remember load time of form.
2. By timer read modifyiedon field of opened record form.
3. Compare it. If retrieved modifiedon datetime is greater then load datetime - execute form reload.

Friday, May 08, 2009

Блоги и сайты, на которых продаются компоненты или функционал под MS CRM 4.0

Я буду очень признателен, если в комментариях будут появляться ссылки на блоги, сайты, ресурсы, где показана функциональность, которую реализовывали другие разработчики под MS CRM 4.0 и которые стоят денег. Вроде вот такого блога - http://mscrm4ever.blogspot.com. В своей предидущей статье я уже за пару часов нарисовал готовую функциональность почти идентичную предложенной продавцом.

В ответ на ссылки - буду оценивать время и т.п. и в соответствии с этим - пытаться повторять функционал, а результаты - выкладывать в качестве статей.

Wednesday, May 06, 2009

Счётчик записей в MS CRM

Прочитав этот топик немного возмутился, потому что даже за мелочи наши заокеанские друзья готовы брать деньги. Мне, как немного работавшим и писавшим под MS CRM сходу было видно чем исполнители пользовались для создания такого функционала и сходу написание такого функционала я оценил в день работы. В этом сообщении я опишу, как и что надо сделать, чтобы получить такого рода функциональность.

Итак сердцем всего решения будет написание плагина на Execute сообщение, который в результирующую выборку будет добавлять запись, в которой будет отображаться количество страниц и записей.

Дальше код плагина - есть комментарии на английском. Если будут вопросы - задавайте.

Saturday, April 18, 2009

MS CRM и Skype

Рассматриваются аспекты совместной работы клиентской части MS CRM и Skype, а именно выполнение звонков из MS CRM и реализация отображения текущего состояния пользователя в Skype в карточке MS CRM. К сожалению описанные методы не будут работать, если на клиентской машине не будет установлен Skype.

Wednesday, April 15, 2009

Делаю быстрый переключатель языка пользователя

Надеюсь, что мой читатель согласится, что переключение языка системы в MS CRM 4.0 не очень удобный механизм. Для этого надо перейти в рабочую область, нажать настройка рабочей области, в открывшемся окне перейти на закладку языки, наконец выбрать нужный язык и нажать ОК. Был разработан механизм быстрого переключения языка и о нём я расскажу в этом сообщении.

Monday, April 13, 2009

Создаём подпись для электронных писем, отправляемых из MS CRM

Один из вопросов недавно заданных клиентом был - как так... В MS Outlook есть возможность автоматического вставления подписи при создании письма, а в CRM - нет... Надо бы исправить данную оплошность. Последующая статья описывает при помощи чего можно добиться похожего результата и в CRM, т.е. - создание и возможность редактирования подписи человеком прямо в CRM и автоматическая подстановка подписи при создании нового письма в CRM.

Скрытие элементов формы редактирования MS CRM

Поставили задачу следующего рода - необходимо скрывать меню Действия (Actions) в некотором перечне карточек. Недолго мудрствуя полез в Гугл и нашёл там решение следующего рода:

var lis = document.getElementsByTagName('LI');
var i = 0;
while (i < lis.length) {
if (lis[i].getAttribute('title') == 'Actions' || lis[i].getAttribute('title') == 'Действия' || lis[i].getAttribute('title') == 'Дії')
{
lis[i].outerHTML='<SPAN></SPAN>'
}
i = i + 1;
}

Решение нормально работало, пока пользователи работали с английским интерфейсом. После того, как интерфейс был изменён на русский или украинский при попытке изменить размер формы вылезла такая проблема: сразу после попытки изменить размеры формы - в левом углу формы появлялось сообщение об ошибке на странице, а при закрытии формы - появлялся диалог о том, что при работе страницы возникла ошибка такого вида:



Выход был опять таки найден при помощи гугла, заключался он в изменении используемого скрипта на такой:

var actButton = document.getElementById('action');
actButton.style.display = 'none';
window.onresize = function(){
actButton.style.display = 'none';
};

Monday, March 16, 2009

Импорт файла Меток для перевода

Поскольку работа по локализации системы не выполнялась в соответствии с моим прошлым постом, то мне пришлось несколько дней биться над переводом файла меток перевода. Работа была выполнена и настал момент загрузки файла перевода в систему.

Tuesday, March 10, 2009

Как правильно локализовать формы MS CRM 4.0

Сначала сделаю небольшой экскурс в прошлое почему я поднимаю эту тему в своём блоге.

Изначально в том проекте, которым я занимаюсь сейчас, планировалось все части русского MUI, поддающиеся переводу, перевести на украинский. Поскольку система доделывалась на ходу и пережила за время своего существования 3-и поколения разработчиков - каждый добавлял новые сущности/закладки/группы/поля так, как он привык это делать. Посему когда я принял систему - в ней было много мешанины из английских/русских/украинских меток.

Friday, March 06, 2009

Установка Украинского MUI

Свершилось наконец то, о чём так долго твердили большевики!

Теперь всем адептам продукта MS CRM 4.0 стал доступен украинский MUI продукта.

Итак начнём

Здравствуйте.

Моё имя Андрей Бутенко. Я работаю консультантом MS CRM в компании S&T Ukraine.

В этом блоге я буду выкладывать свои мысли, идеи, найденные решения, которые так или иначе связаны с MS CRM.

Спасибо за внимание. Недеюсь, в моём блоге вы для себя найдёте что-нибудь новенькое.