i want to capture modifiedon field using javascript and update the value to the custom field how can this be achieved, every time modifiedon updated custom field should be updated
*This post is locked for comments
i want to capture modifiedon field using javascript and update the value to the custom field how can this be achieved, every time modifiedon updated custom field should be updated
*This post is locked for comments
[quote user="Sandy Hello"]
Hi Guido this is the business requirement to calculate difference between start date and end date.Thanks for reply
[/quote]
Hi,
Have you tried using calculated fields?
Create a Calculated field of type whole number.
Use this code on save event of the form.
function setModifiedOn(){ var ismodified = Xrm.Page.data.entity.getIsDirty(); if(ismodified){ var currentDateTime = new Date(); Xrm.Page.getAttribute("new_date1").setValue(currentDateTime); } }
Hi Guido this is the business requirement to calculate difference between start date and end date.Thanks for reply
Refer this:
Hi,
I think you want to capture who has updated the custom field, where you suggest the logic of inspecting the modifiedon field. I would not recommend to use JS for this, as JS can only be run on the form. I believe the back-end solution (plugin/workflow) would be better.
Depending on what you want to achieve, potentially system workflow which is triggered on the update of "modifiedon" field may be sufficient. If your logic requires you to check condition that may not be directly on the updated record, you may need to write a bespoke code to achieve it.
I hope this helps.
Piotr
Hi JaiG thanks for reply i didn't find any possibility to make the above task to achieve through business rule. Please can you elaborate it.
You don't have to use JS to do this.
You should be able to achieve this through a Workflow.
Simply monitor the modifiedon field and have your workflow updaterecord with your field set to either current time or equal to modified on time.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,269 Super User 2024 Season 2
Martin Dráb 230,198 Most Valuable Professional
nmaenpaa 101,156