Created
November 7, 2025 04:11
-
-
Save amitastreait/9520c09ff4c3ad0a81f8a42e28e6b001 to your computer and use it in GitHub Desktop.
DefaultOmniScriptEditBlock.java
This file contains hidden or 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 DefaultOmniScriptEditBlock implements Callable { | |
| global Object call(String action, Map<String, Object> args) { | |
| Map<String, Object> input = (Map<String, Object>)args.get('input'); | |
| Map<String, Object> output = (Map<String, Object>)args.get('output'); | |
| Map<String, Object> options = (Map<String, Object>)args.get('options'); | |
| return invokeMethod(action, input, output, options); | |
| } | |
| global Object invokeMethod(String methodName, Map<String,Object> input, Map<String,Object> output, Map<String,Object> option){ | |
| System.debug(LoggingLevel.DEBUG,'***input**** ' + input); | |
| System.debug(LoggingLevel.DEBUG,'***output**** ' + output); | |
| System.debug(LoggingLevel.DEBUG,'***option**** ' + option); | |
| String accountId = (String)input.get('AccountId'); | |
| String email = (String)input.get('Email'); | |
| String firstName = (String)input.get('FirstName'); | |
| String lastName = (String)input.get('LastName'); | |
| String phone = (String)input.get('Phone'); | |
| String title = (String)input.get('Title'); | |
| Contact newConact = new Contact(FirstName = firstName, LastName = lastName, Email = email, Phone = phone, Title = title, AccountId = accountId); | |
| if(methodName == 'new'){ | |
| insert newConact; | |
| }else if(methodName == 'edit'){ | |
| newConact.Id = (String)input.get('Id'); | |
| update newConact; | |
| }else if(methodName == 'delete'){ | |
| delete new Contact(Id= (String)input.get('Id')); | |
| } | |
| return true; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment