Javascript: Set User Properties

This script sets a given user property for all selected listings at once.
Feel free to modify and improve it to fit your needs.

Inspired by a script written by @Vaguery

Disclaimer:

  • You might want to test this script with one single listing first.
  • There’s no undo function.

More about User Properties

More about GarageSale’s javascript feature

// Set given User Property for all selected listings
function run(){
	
	let propertyKey = "MyProperty"; // replace "MyProperty" with your own property name
	let propertyValue = "MyPropertyValue"; // replace "MyPropertyValue" with your own property value
	
	for (const listing of selectedListings) {
		var userProps = listing.userProperties;
		userProps[propertyKey] = propertyValue;
		listing.userProperties = userProps;
		consoleLog("Set User Property '" + propertyKey + ": " + listing.userProperties[propertyKey] + "' (Listing: " + listing.title + ")");	
	}
}