Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
UI.Vision Script for Xero Practice Manager (XPM) - copy inaccessible fields to custom fields for reports
{
"Name": "Update custom fields",
"CreationDate": "2021-6-11",
"Commands": [
{
"Command": "comment",
"Target": "Works with Xero Practice Manager (XPM) as of creation date",
"Value": "",
"Description": ""
},
{
"Command": "comment",
"Target": "UI.Vision script to automatically copy Client XPM ID to Client Code, and BSB, Account Number and Name to custom fields.",
"Value": "",
"Description": ""
},
{
"Command": "comment",
"Target": "XPM frustratingly does not allow these fields as part of reports so there is no easy way to import this into other software",
"Value": "",
"Description": ""
},
{
"Command": "comment",
"Target": "Import this JSON into UI.Vision, check the storeValue & sendKeys commands are correct using Target Select, and run.",
"Value": "",
"Description": ""
},
{
"Command": "comment",
"Target": "Make sure you have a Client & Contact Report titled \"Full Client List\",
"Value": "",
"Description": ""
},
{
"Command": "comment",
"Target": "With Status excludes: Archived, and [Client] Client as field",
"Value": "",
"Description": ""
},
{
"Command": "comment",
"Target": "Set global variables",
"Value": "",
"Description": ""
},
{
"Command": "store",
"Target": "fast",
"Value": "!replayspeed",
"Description": ""
},
{
"Command": "store",
"Target": "https://practicemanager.xero.com/Client/Client/Edit/",
"Value": "baseURL",
"Description": ""
},
{
"Command": "comment",
"Target": "Get to report page",
"Value": "",
"Description": ""
},
{
"Command": "open",
"Target": "https://practicemanager.xero.com/reports/my",
"Value": "",
"Description": "Open XPM"
},
{
"Command": "comment",
"Target": "Check if logged in",
"Value": "",
"Description": ""
},
{
"Command": "sourceSearch",
"Target": "Log in to Xero",
"Value": "logged_in",
"Description": ""
},
{
"Command": "if_v2",
"Target": "${logged_in} == 1",
"Value": "",
"Description": ""
},
{
"Command": "echo",
"Target": "XPM user not logged in. Script will continue when logged in",
"Value": "#shownotification",
"Description": ""
},
{
"Command": "comment",
"Target": "Loop while waiting for user to login",
"Value": "",
"Description": ""
},
{
"Command": "while_v2",
"Target": "${logged_in} == 1",
"Value": "",
"Description": ""
},
{
"Command": "pause",
"Target": "10000",
"Value": "",
"Description": ""
},
{
"Command": "sourceSearch",
"Target": "Log in to Xero",
"Value": "logged_in",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "comment",
"Target": "Open reports page and select correct report",
"Value": "",
"Description": ""
},
{
"Command": "open",
"Target": "https://practicemanager.xero.com/reports/my",
"Value": "",
"Description": "Open XPM"
},
{
"Command": "clickAndWait",
"Target": "xpath=//*[text()[contains(.,'Full Client List')]]",
"Value": "",
"Description": "xpath=(//*[text()[contains(.,'Full Client List']))@href"
},
{
"Command": "store",
"Target": "!URL",
"Value": "reportURL",
"Description": "Store report URL to loop back to"
},
{
"Command": "comment",
"Target": "Get number of clients",
"Value": "",
"Description": ""
},
{
"Command": "storeXpathCount",
"Target": "xpath=//*[contains(@href,'clientview.aspx?id=')]",
"Value": "r",
"Description": ""
},
{
"Command": "executeScript",
"Target": "var arr = [];\nfor (x=0; x < 600; x++)\n\t{\n \tarr[x] = document.getElementsByClassName(\"link\")[x].href;\n }; \nreturn arr;",
"Value": "cliArray",
"Description": ""
},
{
"Command": "forEach",
"Target": "cliArray",
"Value": "cliURL",
"Description": ""
},
{
"Command": "selectWindow",
"Target": "tab=0",
"Value": "",
"Description": ""
},
{
"Command": "executeScript",
"Target": "str = ${cliURL}; str = str.toString(); return (str.replace(/\\D/g, \"\"));",
"Value": "cliNum",
"Description": ""
},
{
"Command": "executeScript",
"Target": "return (${baseURL} + ${cliNum});",
"Value": "cliURL",
"Description": ""
},
{
"Command": "open",
"Target": "${cliURL}",
"Value": "",
"Description": ""
},
{
"Command": "echo",
"Target": "Now on row ${x}",
"Value": "",
"Description": ""
},
{
"Command": "comment",
"Target": "Enter XPM ID to client record",
"Value": "",
"Description": ""
},
{
"Command": "sendKeys",
"Target": "id=text-1091-inputEl",
"Value": "${CliNum}",
"Targets": [
"id=text-1091-inputEl",
"name=ClientCode",
"xpath=//*[@id=\"text-1091-inputEl\"]",
"xpath=//input[@id='text-1091-inputEl']",
"xpath=//table[10]/tbody/tr/td[2]/input",
"css=#text-1091-inputEl"
],
"Description": ""
},
{
"Command": "comment",
"Target": "Get client bank details and transpose to Custom Fields",
"Value": "CliNum",
"Description": ""
},
{
"Command": "storeValue",
"Target": "id=text-1092-inputEl",
"Value": "CliBSB",
"Description": ""
},
{
"Command": "storeValue",
"Target": "id=text-1093-inputEl",
"Value": "CliAcc",
"Description": ""
},
{
"Command": "storeValue",
"Target": "id=text-1094-inputEl",
"Value": "CliAccName",
"Description": ""
},
{
"Command": "sendKeys",
"Target": "id=text-1135-inputEl",
"Value": "${CliBSB}",
"Targets": [
"id=text-1135-inputEl",
"name=CustomFieldValues",
"xpath=//*[@id=\"text-1135-inputEl\"]",
"xpath=//input[@id='text-1135-inputEl']",
"xpath=//fieldset[5]/div/span/div/table[2]/tbody/tr/td[2]/input",
"css=#text-1135-inputEl"
],
"Description": ""
},
{
"Command": "sendKeys",
"Target": "id=text-1136-inputEl",
"Value": "${CliAcc}",
"Targets": [
"id=text-1136-inputEl",
"name=CustomFieldValues",
"xpath=//*[@id=\"text-1136-inputEl\"]",
"xpath=//input[@id='text-1136-inputEl']",
"xpath=//fieldset[5]/div/span/div/table[3]/tbody/tr/td[2]/input",
"css=#text-1136-inputEl"
],
"Description": ""
},
{
"Command": "sendKeys",
"Target": "id=text-1137-inputEl",
"Value": "${CliAccName}",
"Description": ""
},
{
"Command": "comment",
"Target": "Transpose \"Fee From Refund\"",
"Value": "",
"Description": ""
},
{
"Command": "storeAttribute",
"Target": "id=checkbox-1097@class",
"Value": "test",
"Description": ""
},
{
"Command": "executeScript",
"Target": "var t = ${test}; return t.contains('checked');",
"Value": "cliFFR",
"Description": ""
},
{
"Command": "if_v2",
"Target": "${cliFFR}==true",
"Value": "",
"Description": ""
},
{
"Command": "storeAttribute",
"Target": "id=checkbox-1134@class",
"Value": "test",
"Description": ""
},
{
"Command": "executeScript",
"Target": "var t = ${test}; return t.contains('checked');",
"Value": "cliFFR",
"Description": ""
},
{
"Command": "if_v2",
"Target": "${cliFFR}==true",
"Value": "",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "comment",
"Target": "Close window and restart loop",
"Value": "",
"Description": ""
},
{
"Command": "click",
"Target": "id=button-1143",
"Value": "",
"Targets": [
"id=button-1143",
"xpath=//*[@id=\"button-1143\"]",
"xpath=//div[@id='button-1143']",
"xpath=//div[2]/div/div/div[2]",
"css=#button-1143"
],
"Description": ""
},
{
"Command": "waitForPageToLoad",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment