The CreatorCon Call for Content is officially open! Get started here.

Auto update record date

akin9
Tera Contributor

Hello Experts,

We have Contracts and under contract related lists "Assets covered" are there

created Before BR insert /update to update the start and end dates its working fine.

Before BR insert /update

Table - clm_m2m_contract_asset

 

Requirement

Same w want to achieve for the after update the dates needs to update automatically.

We have tried but no luck, kindly support..

 

(function executeRule(current, previous /*null when async*/) {
	var recordUpdated=false;
	var asset = new GlideRecord("alm_asset");
	asset.addQuery('sys_id',current.asset+"");
	asset.query();
	if (asset.next()){
		if (current.contract.starts!=""){
			asset.u_lease_contract_start=current.contract.starts+" 00:00:01";
		}
		if (current.contract.ends!=""){
			asset.u_lease_contract_end=current.contract.ends+" 23:59:59";
		}
		asset.u_lease_contract=true;
		asset.update();	
	}
})(current, previous);

 

1 ACCEPTED SOLUTION

Hi @akin9 

Oops. Just correct these line below. it should do the trick.

grAsset.u_lease_contract_start=current.starts+" 00:00:01";
grAsset.u_lease_contract_end=current.ends+" 23:59:59";

 

Cheers,

Tai Vu

View solution in original post

10 REPLIES 10

akin9
Tera Contributor

Hi @Maddysunil 

Thanks for the quick reply!

Timi code is working fine.Thanks!