We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

HI All

basha shaik
Tera Contributor

HI All,

i have two tables table A and table B.

 

The value on table B(Like updated date field) should be on table A.

 

 

Thanks

 

3 REPLIES 3

Dr Atul G- LNG
Tera Patron

Hi @basha shaik 

 

Please provide some more details please. are these table are extended from any or like a parent child?

*************************************************************************************************************
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

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

Vaibhav_Nikam
Tera Guru

Hi @basha shaik ,

You can use the After Business Rule on table A for insert/update which will update value in table B Like


(function executeRule(current, previous /*null when async*/) {
	var grTab = new GlideRecord('problem');                          //consider it for table B
	grTab.addEncodedQuery('field='+current.sys_id);            // query for particular record
	grTab.query();
	if(grTab.next())
	{
		grTab.sys_updated_on = current.sys_updated_on;    //update value
		grTab.autoSysFields(false);                                          // false for sys_auto_fields.
	}

	// Add your code here

})(current, previous);

 


If my response finds helpful, please indicate its helpfulness by selecting Accept as Solution and Helpful.

Thanks,

Vaibhav Nikam

Ankur Bawiskar
Tera Patron

@basha shaik 

please share what's your business requirement here'

why have you used 2 tables and what's the purpose for those and relationship between them?

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader