TYPO3 TCA fill in a field with the year of creation and the UID - typo3

I have created a new field in the TCA. This is now empty. Now I would like to fill this in with the creation year and the current UID when creating the data record or afterwards.
Do I have to do this via hooks or tasks?

As the uid of a new record is unknown until the record is saved there could not be a prefill.
Of course you could create a scheduler task to set a field with the value from the creation date (field cr_date) and uid regulary.
But a better solution would be a hook after the record creation as it would be less overhead.
On the other side: as the relevant data already is stored in every record (cr_date and uid):
do you realy need another field with the same information?

Related

How to handle future dated records in postgress using Ef core

I am working on microservices architecture for payroll application.
ORM -EF core
I have Employee table ,where employee details are stored as jsonb column(firstname,lastname,department etc) in postgress .
one of the use case is, I may receive request for future dated changes.Example- Employee designation gets changed next month but I receive request for those change in current month.
I have two approachs to handle this scenario.
Approach 1 :
when I get future dated record(effective date > current date), I will store those records in separate table not in employee master table.
I will create one console application which runs on everyday (cron) and picks up the correct record(effectivedate == currentdate) and update the employee master table.
Approach 2:
almost same as approach 1, instead of using a table for storing future dated record, I will update the record in employee master table.
If I go with approach 2,
I need to delete existing record when effective date becomes current date
when I do get request I should get only current record not future record - to achieve this, I need to add condition for checking effective date. All employee details are stored in jsonb column so I need to fetch entire records with current and future dated record and filter only the current record.
I feel approach 1 is better.Please help me on this. I would like to know another approaches which may fit for this use case.
Thanks,
Revathi

searching by exact value in existing varchar column vs add new boolean column

Which solution is better for performance in postgres database:
search by exact value of existing varchar column
create new boolean column in existing database and search by its value
table contains user id, date of planned job(reservation), date when started job, date when finished job, job name
for now it has around 10k records and it expand by around 2k/year
we want to allow job without earlier reservation but still keep log of start/end date so when backend detect this type of job and it create record with specific name
there is 2 way to see this records: by user which see only planned records and admins who see all
We can do it by excluding for user this specific name or create boolean column with value true if job was created by backend and false otherwise

trigger on opportunity whenever the data of the field get changed in the Custommetadata, then update that field data on the related Account field

2 Fields on Custom metaData:
Opportunity Field Name
Account Field Name
trigger on opportunity whenever the data of the field get changed (the field that are mentioned in the Custom metadata), then update that field data on the corresponding Account field.
I tried to get Field Values from Custom metaData like Map<Id,Object_Field_Mapping__mdt> metaData = new Map<Id,Object_Field_Mapping__mdt>([SELECT Account_Field_Name__c,Opportunity_Field_Name__c FROM Object_Field_Mapping__mdt]);
And now the problem is I am not able to compare these value with the whole Account object so that i can update on Opportunity.....This sounds little bit confusing but this is what i have to do
Is there any way to compare CustomMetaData Field Value with Account Object..
Someone told me it can be used by Schema/sObjects but I am not sure how
You can use Schema like this
Map<String, Schema.SObjectField> accFields = Schema.getGlobalDescribe().get(objName).getDescribe().fields.getMap();
and you can access its field value like this accFields.values()
for(Schema.SObjectField field : accFields.values())
{
//Some Code here
}
for more information about Schema Class and it's Method please check Schema Class
Hope it Helps
Thanks

Gravity Forms - Setting Entry ID as hidden field of current form

I am tying to use this filter to update an existing entry:
https://docs.gravityforms.com/gform_entry_id_pre_save_lead/
However, in the documentation it says:
This assumes that the entry ID to be updated has been submitted with the form from an input which as the input name "my_update_entry_id".
For my scenario it would be ideal if I could capture the Entry ID as part of the entry submission (in a hidden field). Is there a way to do this?
Alternatively, I could dynamically assign an entry ID prior to it being created?
If you are updating an entry, I'm assuming it already exists. If it already exists, you should be able to use dynamic population to populate the existing entry ID into a Hidden field on the form. Then you can use the example from the gform_entry_id_pre_save_lead documentation to update the desired entry on submission.
Here's an existing snippet that does the same thing: https://gist.github.com/spivurno/32e914d67723f89717be2904ce6234c4

Diffrence between "Created On" and "Record Created On"

In CRM, when I'm, trying to set up a work flow, I get to choose the timeout to be related to a certain entity's creation time. There are three fields to relate to.
Record Created On
Created On
Modified On
While the last one is very obvious, I can't see any logical difference between the two others.
The difference is that Created On (createdon) is filled out automatcally by the server when you actually create the record, while Record Created On (overriddencreatedon) will usually be null (unless the record was imported into CRM and you chose to explicitly override the record creation date to match when it was created in another system).
You should use the first and skip the latter, as it's not supported (as far I've got it right when I talked to a MVP about it). Why it show, she had no idea and neither do I. Maybe #JamesWood has a shot. He usually does. (sucking-up in progress)
I've never used the latter and I believe you'll keep your hair off-grey and on-head if you stick to the same approach.
From the SDK:
The createdon attribute specifies the date and time that the record was created. To import data in the createdon attribute, map the source column that contains this data to the overriddencreatedon attribute.
During import, the record’s createdon attribute is updated with the value that was mapped to the overriddencreatedon attribute and the overriddencreatedon attribute is set to the date and time that the data was imported.
If no source value is mapped to the overriddencreatedon attribute, the createdon attribute is set to the date and time that the data was imported and the overriddencreatedon attribute is not set to any value.
Link to BlogSpot
Link to Social MSDN