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

How to Automate Editing an Existing MRVS Row in Service Portal Using ATF?

IsurikaPere
Tera Contributor

I have a catalog item in Service Portal with the following behaviour. 

 

1. User enter a Customer Name

2. User selects an Account Number

3. Based on selected Account Number, the system automatically creates a row in a Multi -Row - variable set called Top Up Information. 

4. The MRYS row contains: Account Number (auto populated)

Top Up Type (Blank) 

 

Business Requirement: 

Before submitting the request, the user must:

1. Click the Edit(pencil) icon on the auto generated MRVS row

2. Select a value for "Top Up Type"

3. Save the record

4. Submit the request 

If the Top Up Type is not populated, the request cannot be submitted. 

 

ATF Challenge: 

What I need is a way to automate below steps

1. Click the Edit(Pencil) icon via ATF

2. Update the Top Up Type value

3. Save the Edited row. 

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron

@IsurikaPere 

there is no out of the box step to edit the MRVS row

You can try to use custom UI step and try to find the pencil HTML and then click it

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron

@IsurikaPere 

there is no out of the box step to edit the MRVS row

You can try to use custom UI step and try to find the pencil HTML and then click it

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

Vikram Reddy
Tera Guru

Hi @IsurikaPere,

 

Don't try to script the pencil icon itself. There's no ATF step that simulates "click the edit icon on row 1" for an MRVS, but you don't need one, the three dedicated Service Portal MRVS steps get you to the same end state (a saved row with Top Up Type populated) without touching the icon at all. The catch in your specific case: since the row is already auto-created by your item's own logic when Account Number is selected, you want to skip the "add a row" step, not use it, otherwise ATF will append a second row instead of editing the one in your first screenshot.

Here's the sequence that ServiceNow's own MVPs point to for MRVS testing in Service Portal:

  1. Open a Catalog Item (SP) to navigate to your item.
  2. Use Set Variable Values (SP) to populate Customer Name and then Account Number, in that order. This fires the same onChange/auto-populate logic that creates the row shown in your first screenshot.
  3. Add a short wait between that step and the next one. Several people running MRVS tests hit timing issues where the row hasn't finished rendering before the next step fires, a 10 to 30 second buffer on the following step is the common workaround reported on Community.
  4. Use Set Variable Values (SP) again, this time targeting the Top Up Information variable set and the Top Up Type variable, with your value. This is functionally the same as opening the Edit Row modal in your second screenshot and picking from the dropdown, ATF drives the same modal, it just doesn't need you to click the pencil to get there.
  5. Follow it with Save current row of multi-row variable set (SP), this is the equivalent of clicking Save in that modal.
  6. Continue with your normal Submit Catalog Item (SP) step.

Do not add an Add row to multi-row variable set (SP) step anywhere in this flow. That step is for rows the tester creates, and since your row already exists on the form the moment Account Number is set, adding one just gives you two rows in the table, the second one blank, and your submit will likely still fail on the same missing Top Up Type in row one.

One thing worth confirming before you build this out: what field type is Top Up Type? If it's a simple choice or reference variable, the flow above should work cleanly. If it's a List Collector inside the MRVS, other Community threads report Set Variable Values (SP) not reliably populating those, so you'd be looking at a different workaround. Also worth noting, and this trips people up every time, ATF's built-in MRVS steps only exist for Service Portal. If anyone on your team ever tries to replicate this same test against the item rendered in the native/Now UI, there's currently no equivalent step for that at all.

References

 

Thank you,
Vikram Karety
Octigo Solutions INC

IsurikaPere
Tera Contributor
Thanks everyone for the suggestions. I wanted to share the approach that ultimately worked for me.
I used a series of Custom UI Test Steps.
Step 1 : 
Click the Edit Row button
The MRVS Edit button was rendered inside an iframe. After inspecting the DOM, I found a stable selector using:
 
[data-original-title="Edit Row"]
 
Step 2: Open the Select2 Dropdown
The Top Up Type field was a Select2 control. A simple. click() did not work consistently. I had to trigger actual mouse events. 
 
Step 3: Select the Required Option
 
The option IDs were dynamically generated, so I avoided using ID s. Instead, I selected the option by visible text. 
Step 4 : Save the MRVS Row
The save button had a stable ID.  I used that one. 
 
Hopefully this helps anyone trying to automate editing existing MRVS rows in Service Portal using ATF.