I have custom object on which there is a standard field 'Name'. The field type - text (Text(80)). It does not autopopulate, and the values it can be set only through the edit page. This field is not mandatory on the project and on the edit page, but when I create a new record of this object this field is autopopulated by Id of this record. Although it is expected that the field should be left blank.
Can I fix this strange behavior with help of some options or settings? Are there any solutions?
I don't think so, it is either auto number or text in which case it'll be required, can not be left blank, salesforce autopopulates the record with the id in case you do not provide one and there is no setting to change that behavior (that i know of on current releases)
I'll recommend changing your requirements and at least populate the name of the record with something, a naming convention for the record on it's current stage would be helpful,
That way you can list all of your "ANONYMOUS" records and assign them into a queue so a business person can go and put the right info just to cite an example, a custom unique identifier which can be recognized by your system or an external application, but never blank
Related
I am working on a report type "Activities with Contacts" and I see that a field called "Last Activity"(date)(api_name: CONTACT_LAST_ACTIVITY) is visible and I am able to add it to the report columns.
I also see that this column is coming from contacts object.
But when I go to object manager and check this in contact's object fields and relationships, this column is not there.
Please let me know if I am missing something. Why is this field visible in report but not anywhere else?
I have checked this column in task, activities, events, accounts objects as well.
Also, this field is not visible in field sets.
Last Activity is a calculated field, it depends in a lot of conditions. It's not in the list of fields of the object. More info about the calculation: https://help.salesforce.com/s/articleView?id=000385365&type=1
If you need it as a field in the object, you can create a formula field that uses the field LastActivityDate, like the example in salesforce help for the lead object: https://help.salesforce.com/s/articleView?id=000387759&type=1
Let's say you have a simple forms automation application, and you want to index every submitted form in a Solr collection. Let's also say that form content is open-ended so that the user can create custom fields on the form and so forth.
Since users can define custom forms, you can't really predefine fields to Solr, so we've been using Solr's "schema-less" or managed schema mode. It works well, except for one problem.
Let's say a form comes through with a field called "ID" and a value of "9". If this is the first time Solr has seen a field called "ID", it dutifully updates it's schema, and since the value of this field is numeric, Solr assigns it a data type of one of it's numeric data types (we see "plong" a lot).
Now, let's say that the next day, someone submits another instance of this same form, but in the ID field, they type their name instead of entering a number. Solr spits this out and won't index this record because the schema says ID should be numeric, but on this record, it's not.
The way we've been dealing with this so far is to trap the exception we get when a field's data type disagrees with the schema, and then we use the Solr API to alter the schema, making the field in question a text or string instead of a numeric.
Of course, when we do this, we need to reindex the entire collection since the schema changed, and so we need to persist all the original data just in case we need to re-index everything after one of these schema data-type collisions. We're big Solr fans, but at the same time, we wonder whether the benefits of using the search engine outweigh all this extra work that gets triggered if a user simply enters character data in a previously numeric field.
Is there a way to just have Solr always assign something like "text_general" for every field, or is there some other better way?
I would say that you might need to handle the Id values at your application end.
It would be good to add a validation for Id, that Id should be of either string or numberic.
This would resolve your issue permanently. If this type is decided you don't have to do anything on the solr side.
The alternative approach would be have a fixed schema.xml.
In this add a field Id with a fixed fieldType.
I would suggest you to go with string as a fieldType for ID if don't want it to tokenize the data and want the exact match in the search.
If you would like to have flexibility in search for the Id field then you can add a text_general field type for the field.
You can create your own fieldType as well with provided tokenizer and filter according to your requirement for you the field Id.
Also don't use the schemaless mode in production. You can also map your field names to a dynamic field definition. Create a dynamic field such as *_t for the text fields. All your fields with ending with _t will be mapped to this.
How can I add ChangeDate field to a global datatype in data perspective? I can add CreateDate field easily but stuck at record modification time.
This is how I add CreateDate field:
Just add a new field and rename it as CreateDate, type is Date
In the advanced tab; remove widget and set default value as function Now.
Can I add another field which one keeps the modification date automatically, if any?
I think event tracking of data addition and updating gives you a solution to add modified date.
You can even remove this modified date field from Mark up. But this will be in DB.
The five events that can be tracked in composite c1 data types are
OnAfterAdd
OnAfterUpdate
OnDeleted
OnBeforeAdd
OnBeforeUpdate
More information on data addition on the following link.
From: burningice
There is a package for it here which you can use to enable ChangeHistory on dynamic types https://bitbucket.org/burningice/compositec1contrib/src/8f53d846304f4dea942b9169481ea3e53580804e/ChangeHistory/?at=default
For static types, just make sure to inherit the Composite.Core.Types.IChangeHistory interface.
Read the full discussion online.
I am kind of new to Salesforce. Could you please let me know what is the difference between Standard Fields and Custom Fields in Salesforce? Can I consider combination of Standard Fields as the unique identifier for a record?
Custom fields are just that. Fields that have been added to the standard Salesforce schema to tailor the data for each object. The user who creates the field can specify the field type and any applicable limitations, such as the maximum number of characters in a text field. These fields might be added to an Org via a managed package or through direct customization.
Standard fields in contrast are those that are already present in the Salesforce schema when a new Organization is created. They are present in all Orgs where the same features are enabled. You can't customize these fields to the same degree. E.g. you could change the display label, but not the underlying API name or data type.
You can see the list of the standard fields in the Salesforce Field Reference Guide
From an API perspective, custom fields are usually identified by a __c suffix (there are a few exceptions, such as GeoLocation fields).
Can I consider combination of Standard Fields as the unique identifier for a record?
You would usually rely on the Id field to be unique. If you wanted to augment this with another unique value, you would create a custom field and mark it as an External ID.
A composite key isn't directly supported. Instead you need to create a Unique Text field and then use a workflow field update or before trigger to populate the unique field with the components of the composite key.
Incidentally, the salesforce.stackexchange.com site is a great place to ask Salesforce specific questions.
I was creating the Recruitment App with Salesforce by going through the study material. I have a question. In the custom object, I saw that I have created a Standard field named "Position Title" and after that I have to create all other fields as "Custom Field & RelationShips". My question is -> Is it the case that Position title is the primary key/unique identified in this object? If that is the case, why the data type is Text(80)? I can have two records with same Position Title "Sr. Manager", right? In that case, my primary key/unique constraint violates.
I have attached the screenshot below:
I am new to salesforce. So please help me in understanding the system? Thanks in advance
Salesforce always create by default a group of fields called 'Standard fields', such as Created date, Last modified Date or Owner. In that list you'll probably interested in two, Id what is the primary key/unique identifier and Name which is a Text(80) field that you can't modify (only define if it's going to be text or an autonumber).
So to answer your first question, Name is actually not unique nor you identifier, and unfortunately at the moment salesforce doesn't give an easy option to have this functionality, in order to achieve that you could write a trigger with that restriction or define the Name as an autonumber and add the position title as a custom field with the unique checkbox marked.
The only problem with that last implementation is that the Name field is a special one with some behavior associated with it and it might obscure some of this functionality. For example, it will be the field shown when adding a relation to that object or in case you add the field to a related list, it will include a link to the actual object, but it will show the autonumber instead of the position title what doesn't give much information about the related object.
Here's a link with other people asking for the same idea.