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

ATF - Validate Records Hidden on Related List for User

DOpoku
Tera Contributor

I am creating an ATF where the user I am impersonating can see the related list but cannot view/access records on certain related list. 

 

Here is what I was able to do so far:

- Impersonate the user 

- Open an existing record 

- Validate the user can see the Related Lists 

 

What I am not able to successfully do in my ATF is:

- The user can see the Related List "Contracts" 

- The user should NOT be able to view/access any Contract records that is linked to the record

- So when the user selects the Related Links 'Contract' the user will see the message "No Records to Display" on the screen for the Contracts related links

 

I am newer to ATF, so things I have tried AFTER I validated the user can see Related Links for Contracts is

- Assert Text on a Page (this didn't work cause it's look at the page, not the Contracts related links) 

- Record Query (I did just a general look up for no matches for records contain CNTR) - this fails cause there are many Contract records 

 

Any recommendations would be great! 

3 REPLIES 3

Shaqeel
Mega Sage
Mega Sage

Hi @DOpoku 

 

If Assert text on page" does not works then ATF have no other way to for your requirement.

 

Regards

Shaqeel


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

Shaqeel

DOpoku
Tera Contributor

@Shaqeel 

 

Thank you for the response.  How do I get the "Assert text on page to reference the Related Links section Contracts? Or can I? There are other Related links on the record that this user can and cannot see. I need to validate that the user cannot seen Contract records on the Related Links section for Contracts. 

 

 

Hi @DOpoku 

 

 

ATF does not have a direct step to verify record hidden in related list. Although, you can use "Run Client script" step.

here is the sample code.

(function step(target) {
    // Get the related list container
    var relatedList = gForm.getSection('task_ci.task_ci'); // Replace with your related list name
    if (!relatedList) return false;
 
    // Count the rows in the related list table (visible)
    var rows = document.querySelectorAll('[id^="element.task_ci"] tbody tr');
    return rows.length === 0; // Returns true if NO rows (i.e., records are hidden)
})(target);

 

 

regards

shql


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

Shaqeel