Bug - Dealing with Custom JavaScript

First I have submitted a bug report and was asked to post here since it involved custom JavaScript. They did provide my some workflow advice, but so far that hasn’t worked.

I am trying to figure out what is causing the error, but no luck so far.

Side note: In my web console when I load a page before doing anything I get the following messages. I included the web console from Chrome and Firefox.

chrome web console error
Chrome^^^^


Firefox^^^^

My actual bug. When I run a workflow by clicking an icon I get the following error in the web console. Again I included Chrome and Firefox.


Chrome^^^^


Firefox^^^^

My workflow is the following. I’m selecting a button on line of a repeating group. This is showing a hidden group to the right and sending the order data to the group. Then I am running the custom JavaScript pulling data from that group.


My Workflow^^^^^

My intention with the Javascript is to take some of the information multiply it and then display it. (very basic explanation)
Right now all the JavaScript is doing is create variables by pulling data from the group and I’m getting the error.

var order_number = "Group - On Page Order Detail's Order's Order Number";

var order_creator = "Group - On Page Order Detail's Order's Creator's First Name";

var order_delivery_date = "Group - On Page Order Detail's Order's Order Delivery Date";

var order_project = "Project";

const order_assembly_uniqueid_list = ["Group - On Page Order Detail's Order's List of Order Line Items's Order Line Item uniqueid"];

const assembly_name_list = ["Group - On Page Order Detail's Order's List of Order Line Items's Order Line Item Assembly's Assembly Name join with ",""];

const assembly_count_list = [Group - On Page Order Detail's Order's List of Order Line Items's Order Line Item Quanity join with ","];

const assembly_material_count_list = [Group - On Page Order Detail's Order's List of Order Line Items's Order Line Item Assembly's Assembly Line Item List's Assembly Line Item Quanity join with ","];

const assembly_uniqueid_list = ["Group - On Page Order Detail's Order's List of Order Line Items's Order Line Item Assembly's Assembly Line Item unique_ID join with ","];

const assembly_material_part_number = ["Group - On Page Order Detail's Order's List of Order Line Items's Order Line Item Assembly's Assembly Line Item List's Assembly Material's Part Number join with ",""];

const assembly_material_lineitem_uniqueid = ["Group - On Page Order Detail's Order's List of Order Line Items's Order Line Item Assembly's Assembly Line Item List's Assembly Line Item unique_ID join with ",""];

const assembly_material_description = ["Group - On Page Order Detail's Order's List of Order Line Items's Order Line Item Assembly's Assembly Line Item List's Assembly Material's Description join with ",""];

const assembly_material_manufacturer = ["Group - On Page Order Detail's Order's List of Order Line Items's Order Line Item Assembly's Assembly Line Item List's Assembly Material's Manufacturer join with ",""];

console.log("TEST");

I’ll update if I find anything else out. Thank you in advance.

Not 100% sure what you are trying to achieve, but if your intent is to do calculation on a list/group I would recommend the Bubble way of doing it. Like “Insert Dynamic Data” of a text label value and do the operation there.

If you still going Javascript then check out the error message saying “unexpected string”. This can be your quotes ( ’ and ") that are mixed up or not ended properly.

Remove everything form your script and run it in debug mode line by line.

@codecompany Thank you so much for that very simple suggestion. I was creating a list of numbers and one end of the list had a (") and the other didn’t. Not sure why I put the quote in but appreciate your help.

Thank you again for the easy solution.

I would love to use the Bubble way, but from my attempts/research it isn’t possible to do.
Not to get off topic from this post, but I’m trying to create a list of material for an order. But the order is made up of ‘Assemblies’ with different quantities and the ‘Assemblies’ are made up of ‘Material’ with different quantities.
I can’t multiple and add all of those together then have a combined list in Bubble as far as I know.

I have a post about it here:

You are welcome!

I must admit, I didn’t read the post you linked to in details but I noticed this: “can’t do arrays in Bubble”. As I understand this is the essence of your problem.

You can do arrays in Bubble, perform looping and manipulation. Check out “Custom states” which you can define on any page element. There you can do “Plus Item”, “Minus Item” and other array stuff. You can -for example- “Intersect” arrays. Custom States is a very powerful feature of Bubble.

Good luck :slight_smile:

@codecompany
So to give you a very brief summary of what I’m trying to do because I’ve tried states and haven’t been able to get it to work.

My current app structure (Things):
‘Order’ → Contains a list of ‘Order Line Item’
‘Order Line Item’ → Contains a ‘Assembly’ and a quantity
‘Assembly’ → Contains a list of ‘Assembly Line Item’
‘Assembly Line Item’ → Contains a ‘Material’ and quantity
‘Material’ → Contains fields about the material…price, part number, description, etc

So what I need to do is for every ‘Order’ come up with a complete list of need material. But having things with two different quantities and having to multiply uneven lists together I couldn’t figure out how to successfully do this so that’s why I’ve moved to JavaScript.

I appreciate all the help and don’t expect you to solve all my problems. Just wanted to provide the quick explanation in case you might have a thought.

See suggestion in the post you linked to.

This topic was automatically closed after 14 days. New replies are no longer allowed.