AnsweredAssumed Answered

ca_reportQuery and ca_doFieldLookup

Question asked by stephen.thurman on Dec 5, 2016
Latest reply on Dec 6, 2016 by pier-olivier.tremblay

I have searched and tried to get a better understanding of these two, but I think they can solve my problem.

I am trying to auto-populate a field based the user filling out the form. So, I already know their _.user.id and it matches to a field in our database. I just don't know how to write the javascript to make it happen, and I think it has something to do with the reportQuery and / or doFieldLookup.

 

So far I've got this -

 

ca_reportQuery('requestorInfo', {'userid':_.user.id}, ca_fd.js.onSuccess, ca_fd.js.onFailure);

    onSuccess: function(result) { 
     if (result.length == 1) { 
           ca_fdSetTextFieldValue(ca_fd.formId, 'org_name', 'correctSuccess'); //So I know where I am when the function fires
       } else {
          ca_fdSetTextFieldValue(ca_fd.formId, 'org_name', 'wrongSuccess');
       }
},

onFailure: function() { 
    ca_fdSetTextFieldValue(ca_fd.formId, 'org_name', 'Failure');
},

 

What I need is to match _.user.id with userid (found in requestorInfo) and the populate 'org_name' with the info found in a table also from requestorInfo.

 

I have a feeling I am very close, but oh so far away.

Outcomes