1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Trigger wont validate

Discussão em 'PSDN - Forum' iniciado por ByronB, Fevereiro 10, 2015.

  1. ByronB

    ByronB Guest

    Hi I am trying to get a trigger working with an update statement, I keep getting "Field "From Relationship" must have a value (line #20)" error and have no idea why? All the correct values are being returned?

    var fromAcc = {!associationFromAccount};
    var toAcc = {!associationToAccount};

    var assocRecId = rbv_api.selectQuery("select id from association where associationToAccount = ? and associationFromAccount = ?", 1, fromAcc, toAcc);

    var currentRecord = rbv_api.selectQuery("select id, fromDescription, toDescription, associationFromAccount, fromRelationship, associationToAccount, toRelationship from association where id = ?", 1, {!id});

    var arr = new Array();
    //arr['id'] = currentRecord[0][0];
    arr['toDescription'] = currentRecord[0][1];
    arr['fromDescription'] = currentRecord[0][2];
    arr['associationToAccount'] = currentRecord[0][3];
    arr['toRelationship'] = currentRecord[0][4];
    arr['associationFromAccount'] = currentRecord[0][5];
    arr['fromRelationship'] = currentRecord[0][6];

    rbv_api.printArr(assocRecId);
    rbv_api.updateRecord("association", assocRecId[0][0], arr);


    I also have a trigger to delete in the same fashion but cant get the formula to validate:

    var fromAcc = {!associationFromAccount};
    var toAcc = {!associationToAccount};
    //rbv_api.println(fromAcc + "|" + toAcc);
    var assocRecId = rbv_api.selectQuery("select id from association where associationToAccount = ? and associationFromAccount = ?", 1, fromAcc, toAcc);
    //rbv_api.printArr(assocRecId);
    rbv_api.println(assocRecId[0][0]);
    rbv_api.deleteRecord('association', assocRecId[0][0]);


    If I use:

    rbv_api.deleteRecord('association', assocRecId); - The formula validates but doesnt work.

    If I use:

    rbv_api.deleteRecord('association', assocRecId[0][0]); - The formula doesnt validate but works...

    Continue reading...

Compartilhe esta Página