This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var o = nlapiLoadRecord("workorder", 2433031); | |
for (var i = 1; i <= o.getLineItemCount("item"); i++) | |
o.setLineItemValue("item", "isclosed", i, "F"); | |
var stat = nlapiSubmitRecord(o); | |
o = nlapiLoadRecord("workorder", 2433031); | |
var x = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JSONParser parser = JSON.createParser(res.getBody()); | |
System.JSONToken token; | |
string text; | |
parser.nextToken(); // Eat first START_OBJECT { | |
parser.nextToken(); // Eat token = FIELD_NAME; text = postalcodes | |
parser.nextToken(); // Eat first START_ARRAY [ | |
parser.nextToken(); // Eat the first object's START_OBJECT { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public with sharing class zipcodeGeonames { | |
// Constructor | |
public zipCodeGeonames() { | |
zipValue = ''; | |
inputCountry = ''; | |
zips = new List<zipInfo>(); | |
} | |
public class zipCodeException extends Exception {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page controller="zipcodeGeonames"> | |
<apex:form > | |
<apex:pageBlock > | |
<apex:actionRegion id="lookupRegion" > | |
<apex:outputLabel value="Enter 5 digit zip code " for="inputzip" /> | |
<apex:inputText value="{!zipValue}" id="inputzip" /> | |
<apex:outputLabel value="Enter Country " for="inputCountry" /> | |
<apex:inputText value="{!inputCountry}" id="inputCountry" /> | |
<!-- The rerender attribute causes addressList to be re-rendered when the button is clicked --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"postalcodes":[ | |
{"adminName2":"Olsztyn","postalcode":"10-509","countryCode":"PL","lng":20.4833333,"placeName":"Olsztyn","lat":53.7833333,"adminName1":"Warmińsko-Mazurskie"}, | |
{"adminName2":"Putnam","adminCode2":"079","postalcode":"10509","adminCode1":"NY","countryCode":"US","lng":-73.599179,"placeName":"Brewster","lat":41.409704,"adminName1":"New York"}, | |
{"postalcode":"10509","countryCode":"DO","lng":-70.24743589230769,"placeName":"Carmen Amelia ","lat":18.721794876923077}, | |
{"postalcode":"10509","countryCode":"DO","lng":-70.24743589230769,"placeName":"La Agustinita ","lat":18.721794876923077}, | |
{"adminName2":"La Magdalena Contreras","adminName3":"Ciudad de Mexico","adminCode2":"9008","postalcode":"10509","adminCode1":"DIF","countryCode":"MX","lng":-98.99779722222222,"placeName":"Residencial San Carlos","lat":19.20726277777778,"adminName1":"Distrito Federal"} | |
]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class casePollList { | |
public ApexPages.StandardSetController setCon { | |
get { | |
setCon = new ApexPages.StandardSetController(Database.getQueryLocator([SELECT Subject, CaseNumber FROM Case WHERE owner.name='Open Cases'])); | |
return setCon; | |
} | |
set; | |
} | |
// Initialize setCon and return a list of records | |
public List<Case> getCases() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page controller="casePollList" > | |
<div style="width:300px;"> | |
<apex:form > | |
<apex:pageBlock id="myBlock" > | |
<apex:actionPoller interval="10" rerender="myBlock" /> | |
<apex:pageBlockTable value="{!cases}" var="c" id="myTable"> | |
<apex:column value="{!c.CaseNumber}"/> | |
<apex:column value="{!c.Subject}"/> | |
</apex:pageBlockTable> | |
</apex:pageBlock> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page standardController="Case" > | |
<div style="width:300px;"> | |
<apex:enhancedList height="250" listid="00B600000074y38"/> | |
</div> | |
<script type="text/javascript"> | |
isListLoaded(); | |
function isListLoaded(){ | |
setTimeout("location.reload(true);",10000); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use a name besides "Account" otherwise you'll get compilation problems due to symbol collision | |
public with sharing class AccountClass { | |
private static boolean isTrigger = false; // Pitfall #4: Used to prevent infinite loops | |
public class accountException extends Exception {} | |
/* format from ziptasticapi.com: | |
{"country":"US","state":"CA","city":"SAN JOSE"} | |
*/ | |
// Format returned by ziptastic API |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trigger accountTrig on Account (after insert) { | |
// When a new account is created, fill in the city and state based on zip code | |
if (trigger.isAfter && trigger.isInsert) { | |
AccountClass.onAfterInsert( trigger.new ); | |
} | |
} |