ATF : Record validation step failing.

tiasha123
Tera Contributor

In ATF , the state in the form  is not changing but while performing the steps manually the state in the form is changing to :Waiting for TMB Approval" in Xanadu release

tiasha123_0-1725537787907.png

 

6 REPLIES 6

@tiasha123 ,

Instead of using the 'Click a UI action', try using 'Run Server Side Script'

 

 

--------------------------------------------------------

 

var changeRequestSysId = steps('sys_id of Record Query step for Change Form').first_record;
    gs.log(' changeRequestSysId ' + changeRequestSysId);
    gs.log('Sys  ID of Change Request is:  ' + changeRequestSysId); //true
    // Get the Change Request record
    var changeGR = new GlideRecord('change_request');
    if (changeGR.get(changeRequestSysId)) {
        // Check if the current state is "Schedule"
        if (changeGR.state == -2) { // Assuming 3 is the value for "Schedule"
            // Set the state to "Implement"
            changeGR.state = -1; // Assuming 4 is the value for "Implement"
            changeGR.update();
            gs.log('Change Request state updated to Implement.');
            // Add result to stepResult to confirm the state change
            stepResult.setOutputMessage('Change Request state updated to Implement.');
        } else {
            gs.log('Change Request is not in the Schedule state.');
            stepResult.setOutputMessage('Change Request is not in the Schedule state.');
        }
    } else {
        gs.log('Change Request not found.');
        stepResult.setOutputMessage('Change Request not found.');
    }
 
 
 
 
Modify the code according to your requirement. 
Let me know if this helps

Hi Ujjwal,

The last step record validation step which is checking for the state -"waiting for tmb approval" , is working as expected while performing it manually , but the state is not changing from "waiting for line manager approval" to " waiting for tmb approval" while testing it in ATF.

tiasha123_0-1725550789403.png

tiasha123_1-1725550873661.png