Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RestResource(urlMapping='/QueryRecords/*')
- global with sharing class QueryRecords{
- @HttpPost
- global static void updateRecords(){
- String mobile = RestContext.request.getParameters().get('Mobile');
- List<Contact> contactList = new List<Contact>();
- List<Lead> leadList = new List<Lead>();
- List<Task> taskList = new List<Task>();
- contactList = [SELECT Id, Name FROM Contact WHERE MobilePhone =: mobile];
- leadList = [SELECT Id, Name FROM Lead WHERE MobilePhone =: mobile];
- for(Contact obj : contactList){
- Task objTask = new Task();
- objTask.whoId = obj.Id;
- objTask.Description = mobile;
- taskList.add(objTask);
- }
- if(taskList.size() > 0){
- insert taskList;
- }
- }
- }
Add Comment
Please, Sign In to add comment