Created
March 5, 2013 15:17
-
-
Save afawcett/5091009 to your computer and use it in GitHub Desktop.
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
global class myClass | |
{ | |
global class wrapperClass | |
{ | |
public String name {get; set;} | |
public Account account {get; set;} | |
public wrapperClass() | |
{ | |
account = new Account(); | |
} | |
} | |
@RemoteAction | |
global static wrapperClass executeProcess(wrapperClass arg1) | |
{ | |
System.debug(arg1.account.AccountNumber); | |
return arg1; | |
} | |
} |
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="myClass"> | |
<script> | |
var wrapper = new Object(); | |
wrapper['name'] = 'Test'; | |
wrapper['account'] = new Object(); | |
wrapper['account']['Name'] = 'My Account'; | |
wrapper['account']['AccountNumber'] = '123456789'; | |
myClass.executeProcess(wrapper, function(result, event) | |
{ | |
if(event.type === 'exception') | |
{ | |
console.log(event); | |
return false; | |
} | |
else if(result) | |
{ | |
console.log(result); | |
// do something | |
} | |
else | |
{ | |
console.log(event); | |
} | |
}); | |
</script> | |
</apex:page> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment