CRM 2011 synchronized records timestamp - dynamics-crm-2011

Our CRM 2011 on-premise setup is such that users create records offline (using Outlook CRM client) and then synchronize them to the server once they are online.
Is there column that timestamps when a particular record (e.g., a sales order) was synchronized to the server? I know I can look at the CreatedOn column, but I can't tell if that is the time when the record was created on the user's machine, or on the server?

You should look at the ModifiedOn field. It will be set to the UTC time when the record was last modified. In the case of a newly created record, that has not been updated, ModifiedOn will equal CreatedOn. Those values are set by the server clock.
I don't recommend ever relying on the local system clock to match the server clock. Do a retrieve of the record from the server and compare the ModifiedOn to the locally stored record to determine if it has been updated.
You can also do a MAX(ModifiedOn) of local records and then query the server for all records with a ModifiedOn greater than the max.

Related

What is the best way to notify users that document expired in database?

In my application users create documents which are then saved in the database. The document has expireAt field which is set to 30 days ahead from the date it is created. After the expiration date the document is considered as inactive.
So, what I want is to send an email to the user after expiration date to notify him that his document is now inactive. The only solution I see is to create a cron job and periodically poll the database for expired documents.
But I'm not sure if periodical polling is a good approach and would like to know if there are other ways of doing this.
P.S. The app is built with nodejs + mongoDB
If your use case is just removing the expired doc, you could use TTL feature of mongodb.
Since you need to send an email, the best option is cron job as you already thought of. Yes, periodically polling is a good option and works in most of the use cases and you do have control over it.
As per your requirement, you could poll once per day. If you are still need to care till minute level of expiry, you could do that by subtracting 24 hours from your actual query and send an alert for user convenience.
Tykaty, you can try to use 2 features of mongodb:
Expire data https://docs.mongodb.com/manual/tutorial/expire-data/
Change events https://docs.mongodb.com/manual/reference/change-events/ https://docs.mongodb.com/manual/changeStreams/#watch-a-collection--database--or-deployment
The idea is simple. You store the documents as before. Add a collection that you will watch and add there objects which should expire, link each document in your original collection to a corresponding object to be expired(1 to 1 link). When the object is deleted by mongo engine(expired), you get a notification with it's _id. Find this _id in your original collection of documents to understand which doc was expired. Here you are.
Of course, you can start with polling, final solution depends on the data and it's usage, the load as well.

DateTime field value inside the SharePoint remote event receiver is different than the one the user enters

I am working on an online SharePoint site collection, which have the following regional settings:-
and I hosted a remote event receiver inside azure web app,where the remote event receiver will get fired when adding/updating list item. now inside the remote event receiver i have the following code to get a DateTime value named ApproveDate:-
DateTime approveBy = (DateTime)projectItem["ApproveDate"];
but if the user enter a value for the ApproveDate equal let say 30/09/2020 inside the SharePoint form as follow:-
then the DateTime value inside the remote event receive will be 9/29/2020 8:00:00 PM instead of 9/30/2020 00:00:00 AM.. so why i am facing this issue? is this because the azure web service have different time zone compared to the SharePoint site? and how i can fix this?
I think this is no problem.
Assuming that the time zone of our web application server IIS is UTC time, then the parameter time passed by your SharePoint is 9/30/2020 00:00:00 AM, and the IIS server time to the web should be minus 4 hours. The time stored by the IIS server is correct. When the front end needs to return, it is UTC+4 hours.
For our program, we should get the parameters of the Sharepoint part of the front-end page, such as time zone and other information, and then we can do the corresponding processing in the code when we return.

Avoid local changes after replication

I have a Notes application that is used offline on a local replica most of the time.
Users can create and update documents.
On the server, an agent processes all new documents.
The idea is that - once the agent processed the documents - the users are no longer allowed to update the documents.
In general, this is quite simple to setup by setting author access on the documents processed by the agent.
But, because users work on the local replica and the agent runs on the server, this scenario is possible:
user creates document offline
replication of document (creating of doc on server)
agent runs on server / user updates document locally
replication of document (updating author access locally / updating changes on server) ==> Causes save conflict or inconsistent data
Is there a way to make sure that the user can no longer update a document once it is replicated to the server.
Or is there a way to force the agent to run on replication and immediately replicate the access update?
I was thinking of creating a button the user can click to replicate/update all documents, but to avoid users that forget to click the button, I prefer the default replication settings to make sure everything is replicated when possible.
When I investigated a few years ago replication does a "pull", then a "push", so doing something on the server won't work. There are a couple of options.
A separate "flag" document which server processing updates, instead of updating the actual document. This would allow for updates causing a second set of processing.
Store a config document / environment variable with the last replicated date, and check against that in the Form's queryModeChange and queryOpen (if editMode). You can then prevent editing if the document was created before the last replicated date.
Instead of using Author fields for the "wrong" reason, I'd add a non-editable Status field, with values like "Initial", "Ready", and all the rest you might need. Then, replication should be set up differently, using a formula that only replicates documents with Status!="Initial". The user might have 2 buttons to save a document: one just saves to the local database and the other also changes the status to Ready. Once Status="Ready", the user can no longer modify the document.
By the way, did you set document replication to "Merge conflicts"? You might reduce the number of conflicts considerably.
One alternative would be to set up the form so that the user never actually saves the document locally. Instead, the document is emailed to the server where an agent triggered by mail delivery performs the actual update. When the agent is done with the update, it sends an email back to the user telling him/her that the updates are available and instructing them to replicate in order to retrieve them. If the Notes client is actually being used for email, you can probably even put a button into the email and say "Click here to replicate and open your document".

How does Acumatica calculate LastDateTimeModified

I have recently noticed that retrieving the LastDateTimeModified (through the WebService API) from Acumatica gives me the date and time in a very different time zone - I am guessing GMT time.
However when I view this through a Generic Inquiry it seems that it is showing the correct time - based on my Time Zone set up in the user profile.
Is there a way to get the LastDateTimeModified in the correct time zone when retrieving from the Web Service API. I have attempted changing the Time Zone for the SDK user with no success
Thanks,
G
For most screens, except a few CRM screens, the LastDateTimeModified and CreatedDateTime are stored in the same time zone as the database server machine. When reading it using web services, you are retrieving the raw value form the database, with no timezone conversion. It is up to you to convert it to the desired timezone.
The Help->Audit History panel does a manual conversion to the current user time zone. I have not been able to get the generic inquiry to show the time as you mention in your question; it is only showing the date.

How to make an emailed document form make changes to my local database?

I have this sample application regarding Change Requests.
If the form is saved, it will send a form as an email to the listed approvers.
The form has 2 actions - Approve and Reject.
Let's say the approver approves the CR. It will update the emailed form document but the document that resides in my local database won't. Is there a way for me to update the documents in my local database automatically if the recipient(approver) has approved/rejected the document form?
Not automatically, but you can add logic to the approve and reject actions to update the database.
If this database is shared on a server, one way would be to make it a mail-in database. Your approval actions could then trigger an email that goes to that mail-in database address. Your database would then need an agent to process the emails, perhaps simply just parsing the subject line which could contain the UNID or some key that says which document to update along with the response of approved or rejected. This would work in a distributed environment.
If the environment is not distributed, say everyone is always on the same network connected to the same Notes server, then you could write some Lotusscript code to update the remote database directly.
Remember the context that you'll be in. When the emailed form is open in an approvers Notes client, he or she doesn't have access to your local databases. So you'll need to have a place on the server that the response action can update.
The safest design for a highly distributed workflow application, (replicas on multiple servers and local replicas on users laptops) is to have the approvals and updates posted as new responses and not have updates directly to the main WF document. The WF document should then compute the statues based on the responses. Finally, an agent running on ONE server can post the status updates to the document and archive the responses.
This construct will eliminate (or reduce significantly) the possibility of replication and save conflicts. It is particularly needed for WF items that require multiple approvals from people who are disconnected or connected to different servers.

Resources