DeveloperTutorials for Web Developers & DesignersAdvanced

Bulk Update Scripts

As an Oncord developer, if necessary you can leverage the Oncord PHP API to run a script to bulk adjust data within an account.

Important: Executing the example scripts below could cause irreversible damage to the data within your Oncord account, so you should experiment with this code using a trial / test account, rather than an Oncord account that contains important data.

Create a Page & Form for your Script

To get started, create a new Page on the website. This page is usually offline, and hidden in navigation. As a standard, we usually create a new page called "_updatescript". 

With the page editor open, click SRC in the left sidebar, followed by the PHP tab.

PHP code will execute as soon as the page is viewed publicly. So you can simply add your PHP to the server code tab, and view the page publicly to run your script. 

As a safer alternative, we usually add a web form to the page which executes a PHP function containing the upgrade script, using the attribute onsuccessserver="yourfunction()". This approach prevents you from executing code prematurely by viewing the page.

Add a form to the Page as HTML:


Open the PHP tab, and enter your code:

Some Example Scripts:

updateContacts(): Update all contacts in a group, setting their home phone number to the value of their mobile number.

updatePages(): Bulk edit all child pages of a given parent page. Update the page content to change all instances of <h1> to <h2>.

deletePosts(): Delete all Posts prior to 01-01-2017.