Reference field Lookup not having the value 20. Adding records from one app to another Error

Reference field Lookup not having the value 20. Adding records from one app to another Error

I am trying to insert records from one application's form to another, but there is one problem. The lookup field DocNumber which links the designated form in second app gives an error during the Insert into process. I tried making the field both Autonumber and typing the value manually. Here is the code I have:

Initial application and form name: app1, Form_request
Target application and form name : app4, Form_Expenses

Function in app4: 
void form_expenses.createRecord(int var1, int var2, string var3, int var4, int var5, int var6, string var7)
{
   insert into Form_Expenses
    [
        Added_User = zoho.loginuser
        DocNumber = input.var1
        Employee_name = input.var2
        Category = input.var3
        Project = input.var4
        Total_amount = input.var5
        Expense_name = input.var6
        Designation = input.var7
    ]
}

Action in "On Success" in app1:

          app4.form_expenses.createRecord(input.DocumentNumber, input.Employee_name, input.Category, input.Project_Rennovation, input.Expense_amount, input.Office_expense_name, text);
    }

The error code I get is:

Error details:
Error in executing On Add - On Success script.
Error.
Error in executing IF rule : Error in executing If block.
Error in executing IF rule : Error in executing Else If block.
Error in executing Call Function task.
Error in executing createRecord workflow.
Error.
Error in executing Add Record task.
Reference field DocNumber not having the value 20.

Once I delete the Lookup field DocNumber linking the two Forms the problem goes away. Note that the action inserts other Lookup fields perfectly fine. Please help solving the issue. This is a very important step in our budgeting workflow.