Function working while editing, not as a button
I have a function that is using information from a Sales Order. I have an argument passing the Sales Order ID (as SO_Number) to the function which I use to look up the Sales Order like this:
condition = "(SO_Number:equals:" + SO_Number.toString() + ")";
mySalesOrder = zoho.crm.searchRecords("Sales_Orders",condition);
...
Do a bunch of stuff
....
The thing is, when I'm editing the function and I use the "Save and Execute" button and I enter a valid Sales Order ID manually, it works fine. But, when I create a button either on the edit page or the view page of the Sales Order layout, it doesn't work. I have the argument mapping set as:
SO_Number = Sales Order ID.
Is there something I'm missing? I figure there must be something wrong with how the ID is being passed when using a button, but I don't know how to track it down either.