Make default primary required field into a lookup - dynamics-crm-2011

When creating a new entity, a new form is automatically created for you where it automatically is given 2 fields, name and owner. For the name field, it is possible to make that into a lookup?

No, the primary field can only be of the type Single Line of Text.
When creating a new entity, you cannot select other types:
This does not stop you from changing the requirement level of the primary field to None and creating your lookup field.

Related

Netsuite. Saved Search, how to join another table

I'm trying to make Saved Search which has Transaction fields that I want to join any other type's fields.
When I make Criteria, Result in Saved Search, I realized there is limitation to bring certain field.
I know the Type & Internal ID, so I used formula(numeric) and insert custom_item.realamount(This is actually what I want to know). But this wasn't show a value.
How can I make these two types to join each other?
There is no field in Netsuite called custom_item If you are trying to join a custom item field on a transaction search formula field then you'd be looking at a join like
{item.custitem_uniquepart_}
Where _uniquepart_ is either an integer if the custom field was created without a custom id value or it's the value entered for the id field of the custom field.

What is the difference, PXSelector vs PXDBScalar

I'm trying to figure out when to use PXDBScalar. Do you guys know the difference between PXSelector and PXDBScalar and when to use which one?
In short PXDBScalar is normally used for unbound DAC fields (not stored in the table). For example if you wanted to have a Vendor name handy within a DAC fetch you could configure a DAC field with the vendor name without having to actually store it in the table. Also this works well with GI's.
PXSelector is an attribute for a DAC field that will allow the GUI to perform a look up of 'possible values' as related to the field.
The below explanations are from help.acumatica.com.
PXDBScalar:
Defines the SQL sub request that will be used to retrieve the value for the DAC field.
You should place the attribute on the field that is not bound to any particular database column.
The attribute will translate the provided BQL Search command into the SQL sub request and insert it into the select statement that retrieves data records of this DAC. In the BQL command, you can reference any bound field of any DAC.
Note that you should also annotate the field with an attribute that indicates an unbound field of a particular data type. Otherwise, the field may be displayed incorrectly in the user interface.
You should not use fields marked with the PXDBScalar attribute in BQL parameters (Current, Optional, and Required).
PXSelector:
Configures the lookup control for a DAC field that references a data record from a particular table by holding its key field.

IBM Maximo Lookup selecting another value not default value

I am trying to create a lookup. I want to select from PERSON table - if I select a value through lookup, person id is selected, but I need display name value. I have tried by creating a table domain, lookup table, lookup.XML and all methods.
If you need the DisplayName copied to the local object in addition to the PersonID, then instead of a Table Domain, you need a Crossover Domain with DisplayName as a Source Field and with your local attribute that should hold the copy of Person.DisplayName as the Target Field.
If you need the DisplayName copied to the local object instead of the PersonID, then you'll need to make a lookup map on the target attribute so Maximo knows what attribute returned by the domain maps to which attribute on the local object. You set Lookup Maps with the little, white, "page" icon/button on the right side of the Attributes tab in Database Configuration for the desired target attribute.
If you just need to see the DisplayName once a PersonID is selected, then use a Mulitpart Textbox and set "Attribute for Part 2" to something like PERSON.DISPLAYNAME, where PERSON is the name of the relationship from the local object to the PERSON object.
As Preacher already mentioned, you can copy the DISPLAYNAME attribute using a lookup map - on the Database Configuration application, go to the attribute to which you want to copy - probably the one, where you used the table domain on - and click the icon.
If you have created a custom field and have no Java class on it, you will still need the table domain, so leave that on the attribute. Now, on the lookup map, you can define which fields you want to copy from the source MBO to the target MBO. You can define multiple target fields from here (so no need to define a crossover domain, even if you need to copy multiple fields) - just enter a new line for any field you want to copy from the source (Person) object.
On many versions of Maximo you will have to restart before this starts working! I believe you don't have to restart on 7.6, but on any previous version you will probably have to.
Now, about the definition in lookups.XML: if you want to show different attributes than the ones, already shown on the default "person" lookup, you need to define your own, as you did. If the default one looks fine, for you, you can just use "person" as the lookup, since the logic of copying fields is defined in the lookup map, not in lookups.XML.

Azure Table Storage - remove columns

I think this is not possible, but however I ask the question, maybe I have missed something.
Can we add/remove columns from an azure table?
For example by default we get those columns: PartitionKey, RowKey, Timestamp, ETag. Can I add for example another 3: FirstName, LastName, Email columns?
After that I will insert some values and I want to remove column Email and add instead column Address. Can we do this?
As Igor rightly said, Azure Tables do not have the concept of rows and columns. A table can contain zero or more entities and each entity can have a maximum of 255 attributes (an attribute is a name/value/type). Off of these 255 attributes, 3 of them are system attributes (PartitionKey, RowKey and Timestamp) which you can't update through your code. When creating an entity you define PartitionKey and RowKey and after that they become readonly properties. So when it comes to updating an entity, you can only update 252 attributes.
To manage data in an Azure Table, there's a REST API and you provide attributes of an entity in the request body. Azure Storage provides two ways by which you can update an entity - Update and Merge.
When you tell Azure Table Service to Update an entity, it simply drops all the existing attributes for that entity, and inserts the attributes defined in the request payload.
When you tell Azure Table Service to Merge an entity, it looks at the existing entity attributes and compares them with the attributes defined in the request payload. If it finds matching attributes, it simply updates those attributes. If the attributes are not present in existing entity but are defined in request payload, those attributes get added to the entity. If the attribute are present in existing entity but are not defined in request payload, they are not changed.
Now coming to your problem.
So let's say you already have an entity where you just defined PartitionKey and RowKey. Now you want to add FirstName, LastName, Email attributes. Because these attributes are not there in the entity, you can either use Merge or Replace to update the entity and these attributes will be added to the entity.
Now you want to drop Email attribute from an entity and instead add Address attribute to that entity. What you will do is perform an Update operation on that entity where your request body will have FirstName, LastName and Address attributes only (no Email attribute). When you update the entity with this request payload, Email attribute will be removed from the entity.
Azure Tables do not have "columns" as SQL tables do. Azure Tables have entities. Each entity has up to 255 properties. Most tools that let you look at an Azure table, choose to visualize the data in it tabular with columns. However, in reality, each entity (row) is a collection of properties.
Therefore, you can save objects/entities into an Azure Table with different properties, everytime you do a save. It makes things somewhat confusing, but you can do it.
HTH
I think programmatic answers given above is the best solution in terms of achieving the functionality.
But in case, you are working in the development mode and you have inserted an unnecessary attribute which you want to remove. you can do the same by using azure storage explorer.
You can export the table of choice, delete the property in the CSV file and import it back in new table. drop the existing table and rename the new table to the existing one. This is kind of a work around.

Dynamics CRM 2011 SQL MetadataSchema Primary Name Attribute

I am trying to create a custom Audit summary report based on a date range that needs to be emailed nightly. I've got most of it working, but need some help with getting the primary name/field/attribute for a referenced entity. I noticed in the Audit view for a referenced entity, the data is stored like 'systemuser;'. What I would like to do is grab the Primary Field (Primary Name, Primary Attribute, whatever it's called) to display on the report. Does anyone know how to find the Primary Name attribute for an entity using the MetadataSchema views in the CRM SQL database? I have found the Primary Key field by looking at the MetadataSchema.Attribute.IsPKAttribute field, but I don't see anything for the Primary Name field.
Also, I am grabbing the current values from the entities if there are no following audit entries. For the lookup fields (like owner or customer) how can I tell from the Metadata what field stores the ObjectTypeCode? For example, if I was looking up the customer on a sales order, I know I can look at CustomerIdType field to find the ObjectTypeCode, but I need to find that the field is called CustomerIdType from the metadata.
If anyone has any good references on the Metadata from the SQL side of CRM, I would greatly appreciate it.
SQL query to get primary fields for all entities
SELECT e.Name as 'entity', a.Name as 'primary field'
FROM [dbo].EntityView e
left join [dbo].AttributeView a on e.EntityId = a.EntityId
where (a.DisplayMask & 256) > 0 --256 is for primary field
order by e.name
There are two cases to get object type code of lookup
append Type to field name (i.e. CustomerIdType)
if above is not available, get it from AttributeMetadata
SELECT ReferencedEntityObjectTypeCode
FROM [Discworld_MSCRM].[dbo].[AttributeView]
where name = '<field name>' and entityid = '<entity id>'
I'm not sure what exact rules are for Type fields to exist

Resources