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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 29.04.2014, 20:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
axmfg: Product Configuration: Setting values based on system variables - example, current user ID
Источник: http://blogs.msdn.com/b/axmfg/archiv...t-user-id.aspx
==============

In this blog post we will describe how you can set values
based on the current user ID by leveraging system-defined table constraints
together with the build-in query range methods.



If you are familiar with the Product Builder configurator,
you may by familiar with the User Profile
feature where you can associate a collection of default values with a given
user. Use the following description to achieve a similar behavior using the
Product Configurator.



Creating the System Table



The table we create for this example should look like this and have two columns, that is, one for
the User ID (uses the UserID EDT) and one for our user-specific value (an Integer to keep it simple).







Once the table is created, we can add the user specific data.



As seen above, we have added the value 42 for the Admin
user ID. The intention is that when the table constraint is created and used in
model, the attribute, which will be bound to the UserSpecificIntegerValue
column, will be assigned the value that corresponds to the current user ID.



Creating the Table Constraint

Now that the System Table is created, we can create the actual table constraint. This is done by
opening the Table constraint definition
form, under Product information management -> Common -> Product configuration models.

Create a new table constraint by clicking the new button.



Select System defined, and enter the name of the table created previously.



Add a column for the user-specific integer value and choose an integer attribute type with ranges.



Now comes the part which gives the attribute a user-specific value. This can be accomplished by
opening the Select query (SysQuery) form and entering the range specified
below. The content of the table will be filtered to just return the records
associated with the current user ID.



Click OK to complete the table constraint creation, click Next in the Wizard, and then click OK again.

Using the system-defined table constraint in a Product configuration model

Having just created our system-defined table constraint, we are now ready to use it in a Product
configuration model. Below I have create a very simple model with 3 attributes:
  1. One integer attribute to hold
    the user-specific value
  2. Two boolean attributes for
    each of which I will be using the Hidden modifier with a condition
    expressing that the attribute is only to be shown if the user-specific
    value matches that of the current user.
    The "Only Admin" attribute will be hidden if the user
    specific value is different from 42.




Similarly, I have added an attribute named "Only Dmitry", which only will be
visible if the user log on to Dynamics AX is associated with User ID Dmitry.



Once the attributes have been defined, it's time to attach the table constraint to the
model. This is done by creating a new constraint in the constraints section and
selecting Table constraint in the opened dialog.

Then select the new table constraint and associate the user-specific value attribute with
the user-specific value column, as shown below.



Launching the model and understanding the results

We are now ready to launch the model we created with the attached table constraint. As can be seen
below, once the model is loaded, the User Specific Value is assigned the value 42 by the configurator. The "Only
Admin" attribute is shown and the"Only Dmitry" attribute is hidden.





This example can be extended to include several other concepts like hiding subcomponents and
grouping user specific value into table constraints. An obvious use case would
be that you hide some parts of the Product configuration model from the order
takers (Susan persona). This could be engineering-specific details and the
product designer (Emil persona) would still be able to see them.



Furthermore, the above pattern can be used together with other of the build-in query range
methods.


  • currentCompany
  • currentLanguageId
  • currentUserLanguage
  • currentLegalEntity
  • currentParty

Note:

It you are running
on a build that has a performance fix to run the XML generation in IL, you will
need to generate IL for the SysQueryRangeUtil class.



I hope you find this useful










Источник: http://blogs.msdn.com/b/axmfg/archiv...t-user-id.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
axmfg: Understanding the default configuration concept for constraint-based products Blog bot DAX Blogs 0 17.07.2013 14:11
DynamicsAxSCM: Product-item data management services Blog bot DAX Blogs 0 06.07.2011 17:11
Удаленная работа с CRM и расширеный поиск ASheff Dynamics CRM: Разработка 64 04.06.2010 17:44
Ошибка бизнес-процесса Tarasov E Dynamics CRM: Разработка 9 18.02.2010 14:02
при построении перекрёстных ссылок выдаётся сообщение об ошибках mmmax DAX: Программирование 10 21.01.2005 12:42

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

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

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