HI,
i'm devloping an application to store and track all the devices in the comapny, and users needs to update device details like current assignee, status, location and device condition, My question is what if one of the users wants to update the asignee and location or device condition at one time how can i capture the event ID in this case? i need to store in the logs that assignee has been updated and location has been changed, what is the best solution here?
Discussion posts and replies are publicly visible
Ayman95 , Yes you should be able to do this. In your update interface have the existing data in a local variable which does not refresh and compare these updated values with the existing and if there is a change in the field value then iterate using a!foreach and construct a record using your Event history Record Type for each item. then you would save this array of records on submit. But you will have to make changes to the existing PM that has been configured and not include the event history in the write records of the actual update records node instead have a separate write records for your Even History Record Type.
Great! can you explain more about for each and how to store this multiple events or actions?
Have a initial query for your record in a local variable with refresh as always false, which will not have anything to do with the rule input of the record. Now when you make changes to any value only your rule input would change. Now in the submit button you need to add a save with your Event record rule input and write a foreach to save this.
a!save( ri!eventHistory, a!foreach( items: ri!record, expression: if( exact(ri!record.feild1, local!record.field1), {}, recordType!eventHistory(field1: {}, feild2: {}) ) ) )