Discussions

 View Only
  • 1.  AddRecord adding wrong data

    Posted 10-03-2017 16:59
    Im trying to create a button that adds a line to an inventory table if an item is unable to be returned. My code is adding a line to the inventory table but not the correct information. It needs to copy the line item information.
    Here is the info it is supposed to be copying:
    ProductCode = 20
    Product - Supplier = Interceramic

    But it is inserting:
    ProductCode = 1
       (It is inserting the 20th item in the Products List)

    Here is my code:
    var text URL = URLRoot() & "db/" & [_DBID_SHOWROOM_INVENTORY_LEVEL] & "?a=API_AddRecord"
    & "&_fid_7=2"
    & "&_fid_6=Unrecoverable"
    & "&_fid_12=" & URLEncode([ProductCode]);

    "javascript:" &
    "$.get('" & 
    $url & 
    "',function(){" &
    "location.reload();"&
    "});" &
    "void(0);


  • 2.  RE: AddRecord adding wrong data

    Posted 10-03-2017 18:13
    A few ways to troubleshoot include using the AddGenRecordFrom without the refresh, and have it auto populate the information you want. 
    If that is working well, then you can switch it back to the AddRecord call with the refresh.

    Another bug checker is to "copy the link address" by right clicking on the link/button.  
    Then paste the code so you can look at it all formatted for the URL and see if there are some syntax errors.


  • 3.  RE: AddRecord adding wrong data

    Posted 10-03-2017 20:06
    I figured it out, where _fid_12="&URLEncode([ProductCode]), i changed it to [Related Product].