Important Update: Community URLs redirect issues are partially resolved. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding values for new record using API

Kunal
Contributor III

I have an application A, which cross refers to questionnaire Q which is targeting Application T.

 

When I click on Add New from A, select a record from T as target, the window for new record for Q is shown.

 

In Q, there are 2 fields, reviewer and submitter. I wanted to "Pre-Populate" these two fields from fields in A, say:

 

Focal Point 1 -> Reviewer

Focal Point 2 -> Submitter

 

I managed to get the values using REST APIs. But, these values don't populate by default when the new questionnaire record window appears. When I save the questionnaire record, the APIs/ Custom Code runs fine, and I am able to see the user from Focal Point 1 in Reviewer.

 

Is it possible to populate the Reviewer (/submitter) by default when a new questionnaire record is created (without needing to click on save?)

 

I have attached the script in case it helps.

3 REPLIES 3

Ilya_Khen
Champion III

Hm, try to use 

Sys.Application.add_load(function() {

}

 

instead of document.ready();

DavidPetty
Archer Employee
Archer Employee

Kunal try switching $(document).ready(function(){ ... }); to Sys.Application.add_load(function() { ... });

 

Make sure your user selection isn't configured as drop-down as Archer doesn't populate the selections till the user clicks the down arrow.

 Advisory Consultant

Kunal
Contributor III

David PettyIlya Khen

 

Bit Long, but please read

 

Did a couple of rounds of workarounds and troubleshooting. 

 

I was running the custom object from Q, and it seemed that in a new Q record, the values from A were not obtainable (console output was saying as such). There were also conflict resolution pop-up showing, to which I believe there is no workaround (as pointed out by various posts in this forum).

 

So, from the record of application A (say ARec), I am now doing the following:

  • When the Add New of Q from ARec is clicked, I am calling a custom CreateProfilingQuestionnaire() function which:
    • takes the required values from the ARec 
    • creates the Q questionnaire record (QRec) using these values 

 

The following is set on the POST call to create QRec:

  • Submitter Field
  • Review Field
  • Related Record (pointing to ARec)

 

However, the reference to QRec is not visible from ARec, eventhough QRec is being created as required. In QRec, the related record field is correctly pointing to ARec.

 

When I save ARec, (using

$("#master_btnApply").click();

) , I saw the same Conflict Resolution Pop-Up. Back to square one.

 

So, browsed through the forum some more and went through the following post by David:

https://community.rsa.com/message/887208?commentID=887208#comment-887208 

 

 

I modified the required lines to set the value of Xref to QRec from ARec. 

 

The animation loads and then I get an Unexpected Error msg. The required QRec is being created though. And if I open ARec, the cross reference shows correctly. So:

  1. Is it possible to show the cross ref from ARec to QRec, after QRec is created without Apply/Save? Which function do I use?
  2. I have a feeling that I am missing something here. The reason I say this is I have seen multiple posts here where the values are updated on the record being edited using custom object. Don't they have conflict resolution Pop-Ups? What am I doing wrong?
  3. For the above stated Unexpected Error message, where do I see the logs?

 

I have attached the modified script. Please advise.