HI All

basha shaik
Tera Contributor

HI All,

 

i have two tables

1.dms_document 

2.dms_document_revision

 

i need fetch the field value(update date) dms_document_revision to dms_document .

Please any one suggested

 

ADV Thanks

3 REPLIES 3

Dr Atul G- LNG
Tera Patron
Tera Patron

and where you will store this value in other table, other table also has same field name.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

no different name

Hi @basha shaik 

 

(function executeRule(current, previous /*undefined*/, action) {

// Define the document_id
var documentId = current.document_id;

// Create a GlideRecord object for the dms_document_revision table
var revisionGR = new GlideRecord('dms_document_revision');

// Query to get the latest update_date for the given document_id
revisionGR.addQuery('document_id', documentId);
revisionGR.orderByDesc('update_date'); // Order by the latest update_date
revisionGR.setLimit(1); // Only get the most recent revision
revisionGR.query();

// Check if a result is found
if (revisionGR.next()) {
var latestUpdateDate = revisionGR.update_date;

// Now, update the dms_document table with the latest update_date
current.update_date = latestUpdateDate;
current.update(); // Save the changes to the dms_document record
}
})(current, previous);

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************