How to do - Audit Engagement Dates Update
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-04-2024 02:57 AM - edited 12-04-2024 02:58 AM
Hi Friends,
I have requested by my client recently to update engagement dates for future engagements lets say for years 2025 and 2026 which they have some date information updated already.
I am writing this post just to give some insights on how to perform this date update on Audit Engagement Record.
Here is the actual request: For all 2025 and 2026 Engagements, They want to set it as below,
Engagement Planned Start ==> Fieldwork Planned Start
Engagement Planned End ==> Fieldwork Planned End
Duration ==> Should reflect difference between these 2 dates
Initially I thought of doing manual update, as the records are very few say 30 engagement records. But the difficulty I faced in populating Fieldwork Planned Duration field as there are some business rule that does not allow me to set Fieldwork Planned End which is read-only even though you set both Fieldwork Planned Start and Fieldwork Planned Duration fields.
I decided to use data import with some script mapping as below,
Step 1: Below is the template I have used for import,
Number | Name | Audit Period Start | Audit_Period_End |
ENG0020037 | 2025 - Engagement 1 | 2025-01-01 | 2025-03-31 |
ENG0020057 | 2026 - Engagement 1 | 2026-01-01 | 2026-03-31 |
Step 2: Create a data source and load these records to create transform map.
Step 3: Below is the mapping you should do for Source and Target fields and copy the script in next steps. Make sure you have Coalesce field for your import.
Step 4: Copy scripts for each source field in script area by clicking "Use Source Script" Checkbox.
Fieldwork planned start:
answer = (function transformEntry(source) {
return source.u_audit_period_start+" 00:00:00"; // return the value to be put into the target field
})(source);
Fieldwork planned end:
answer = (function transformEntry(source) {
return source.u_audit_period_end+" 00:00:00"; // return the value to be put into the target field
})(source);
Duration:
answer = (function transformEntry(source) {
var timemsStart = source.u_audit_period_start.dateNumericValue();
var timemsEnd = source.u_audit_period_end.dateNumericValue();
var diff = timemsEnd - timemsStart;
target.duration.setDateNumericValue(diff);
})(source);