Bookshelf Home | Contents | Index | PDF |
Oracle CRM On Demand JavaScript API Developer's Guide > JavaScript API Code Samples > Code Sample for a Custom Button That Gets a Shipping Address to Pass to an External SiteThe following code creates a custom button labeled Map Shipping Address on the Account Detail page. When the button is clicked, the shipping address is passed to an external URL, in this case, the URL for Google Maps. // example: create a map button // entry point for running custom code oraclecrmod.onReady(function() // when on the Account Detail page if(oraclecrmod.ctx.object == "Account" && oraclecrmod.ctx.isDetailPage()) if (oraclecrmod.getField("Ship To Street Address") != null) wholeAddress += oraclecrmod.getField("Ship To Street Address").getValue() + " "; if (oraclecrmod.getField("Ship Street Address 2") != null) wholeAddress += oraclecrmod.getField("Ship To Street Address 2").getValue() + " "; if (oraclecrmod.getField("Ship Street Address 3") != null) wholeAddress += oraclecrmod.getField("Ship To Street Address 3").getValue() + " "; if (oraclecrmod.getField("Ship To County") != null) wholeAddress += oraclecrmod.getField("Ship To County").getValue() + " "; if (oraclecrmod.getField("Ship To Postal Code") != null) wholeAddress += oraclecrmod.getField("Ship To Postal Code").getValue() + " "; if (oraclecrmod.getField("Ship To Country") != null) wholeAddress += oraclecrmod.getField("Ship To Country").getValue() + " "; window.open("http://maps.google.com?q=" + encodeURIComponent(wholeAddress)); titleBar = oraclecrmod.getTitleBar("AccountFormTB"); button = oraclecrmod.createButton({id:"mapButton", text:"Map Shipping Address", parent:titleBar}); |
Oracle CRM On Demand JavaScript API Developer's Guide, Release 34 | Copyright © 2017, Oracle and/or its affiliates. All rights reserved. Legal Notices. | |