Javascript corrupts listing in GS

The enclosed JS code will corrupt a listing in GS causing GS to crash and will continue to crash GS whenever the listing is selected. The only way to recover is to delete the folder that contains the listing.

I am using the latest stable version of GS.

function run(){
	for (const listing of selectedListings) {
		var attr = listing.attributes;
		if (listing.productBarCode) { attr["ISBN-10"] = listing.productBarCode; }
		listing.attributes = attr;
	}
}

Turns out, the value for each attribute should be an array of strings, not a single string as in your example.

The latest GS 9.8 beta version will now accept with the code example you posted, and listings where you used that script on should be selectable again:

2 Likes