Posting date time not populating in the transaction details

User205031
Tera Contributor

Hi All,

 

My requirement is to populate posting date time in the transaction table.

Posting date time should be mapped to CPD value.

In CPD value comes from Financial transaction table so dot walked from that table to add it in the data resource.(attached SS)

Den tried to call the variables to populate the value in the workspace:

function evaluateProperty({ api, helpers }) {
   

    var postingDate =
        api.item.value["financial_transaction.ref_sn_bom_deposit_transaction.u_cpd1"];

     console.log("SSTime1" + JSON.stringify(api.item.value));

    return [
       
        {
            label: helpers.translateSync("Posting date time"),
            value: {
                type: "string",
                value: postingDate && postingDate.displayValue
                    ? postingDate.displayValue
                    : "-"
            }
        }
    ];
}
 

console is returning : "ref_sn_bom_deposit_transaction" : null

 
 
 

 

1 REPLY 1

Tanushree Maiti
Kilo Patron

You can achieve it by before insert,update BR -

 

Assumption: 

you have a custom Date/Time field (e.g u_cpd1) on the Financial transaction table (Mention the correct transaction table)

then you can write script something like this.. Table name /field ..do dot walk as per your requirement.

 

This code is just sample code.

(function executeRule(current, previous /*null when async*/) {    if (current.u_postingDate.nil()) {
           var cpdVal = current.ref_sn_bom_deposit_transaction.u_cpd1; 
                if (cpdVal) {                       current.u_postingDate = cpdVal; 
        }
    }

})(current, previous);

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: