How to do - Audit Engagement Dates Update

PrakashRam
Tera Contributor

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,

NumberNameAudit Period StartAudit_Period_End
ENG00200372025 - Engagement 12025-01-012025-03-31
ENG00200572026 - Engagement 12026-01-012026-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.

 

PrakashRam_0-1733304191359.png

 

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);

 

 

 
Above scripts sets the values of each dates field to proper format from source value. Duration script just identifies the difference between start and end script and sets to the target duration field. Now you run the transform map and your import should work as expected.
 
Thanks.
 
0 REPLIES 0