Custom Script - Fetching values from different doctype's forms

Hello, guys!
I’m fairly new to customization and I’m having trouble on something.
I have two doctypes: Doc I and Doc II. Doc I has 4 fields: 2 Data (Data A and Data B) and 2 Int (Int D and Int E). Doc II has 2 fields: 1 Data (Alfa) and 1 Int (Beta).
I’ve made a Custom Script to create a button. When the button is clicked I’m expecting to create a new Doc II form with the values of Data A and Data B fields from Doc I form concatenated in Alfa. Also, the Int values Int D and Int E summed in Beta.
The JS code I’ve used to create the Custom Script is below.
I managed to get the expected result for Alfa but I just couldn’t make it work for Beta.
During tests I’ve changed Beta’s type to Data and the value transfer was sucessful.
But I really need Beta’s type to be Int. Is there anyone who knows what I’m getting wrong?
Appreciate your help. :grin::grin:

When Beta’s type is Int

When Beta’s type is Data

I’m also trying to do a similar thing. Developing a custom app and modelling a Document Flow for my company, but I am stuck in the same problem. Can’t make the method frappe.new_doc work.

What if you put a hardcoded int value for beta? If it works then put the sun into a variable before putting the variable into beta

try using parseInt() function