Bookshelf Home | Contents | Index | PDF |
Oracle CRM On Demand JavaScript API Developer's Guide > JavaScript API Code Samples > Code Sample for a Read Operation on an Account RecordThe following sample code is for a read operation to get details of an account and display them in the Description field on the Contact Edit page. A call is made to the readRecord() method to get the values for the Type and Location fields of the associated account. // entry point for running custom code - only before the page loads oraclecrmod.onLoad(function () { var contactCallback = function (request, response) { if (response.status == "OK") { var type = response.getFieldValue("Type"); var location = response.getFieldValue("Location"); //update the description field with account record info oraclecrmod.getField('Comment').setValue("This contact is created by the account with type " + type + " and located at " + location); // when on the Contact new page if (oraclecrmod.ctx.object == "Contact" && oraclecrmod.ctx.isNewPage()) { var acctId = oraclecrmod.getField("Account Id").getValue(); oraclecrmod.dataSvc.readRecord("Account", "Location,Type", { |
Oracle CRM On Demand JavaScript API Developer's Guide, Release 36 | Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices. | |