Skip to content

Instantly share code, notes, and snippets.

View msrivastav13's full-sized avatar
🎯
Focusing

Mohith Shrivastava msrivastav13

🎯
Focusing
View GitHub Profile
<apex:page standardStylesheets="false" sidebar="false" showHeader="false" controller="AngularJSDemoCtrl">
<html xmlns:ng="http://angularjs.org" ng-app="hello" lang="en">
<head>
<meta charset="utf-8"/>
<link href="https://netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap.no-icons.min.css" rel="stylesheet"/>
<link href="https://netdna.bootstrapcdn.com/font-awesome/2.0/css/font-awesome.css" rel="stylesheet"/>
<apex:includeScript value="{!$Resource.Angularjs}"/>
</head>
<script type="text/javascript">
global with sharing class AngularJSDemoCtrl {
public class Accountwrap {
Accountwrap() {
Website = '';
AccountSource = '';
Phone = '';
@msrivastav13
msrivastav13 / JqueryAutocomplete
Created June 29, 2013 16:41
Jquery Autocomplete with Remote Action
<apex:page controller="MyJSController">
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript">
$(function() {
@msrivastav13
msrivastav13 / Maputil
Last active July 20, 2017 15:13
Maputil class shows an example on how to use Maps to form MAP<Id,List<Sobjects>>
Map < Id, List < Contact >> mapAccIdByCntlst = new Map < Id, List < Contact >> ();
for (Contact c: [Select Id, name, AccountId from Contact where AccountId != null]) {
// AccountId mapping with Contact List
if (mapAccIdByCntlst.containsKey(c.AccountId)) {
mapAccIdByCntlst.get(c.AccountId).add(c); //tricky part .Here map.get(key) is returning list and we are adding contacts to the list
} else {
List < Contact > lstcnts = new List < Contact > (); //Initialize list as no key is found before and first time we get key
@HttpPost
global static string postwebserviceutil() {
//Extracting the data from the JSON HTTP request object sent from Timetrade
RestRequest req = RestContext.request;
RestResponse res=RestContext.response;
Blob body=req.requestBody;
String jsonToParse=body.toString();
@msrivastav13
msrivastav13 / gist:6291230
Last active December 21, 2015 10:19
SalesforcetoSalesforceConnectionOauthAutonomousClient
ublic class TestCallout {
public static void TestCallout(){
String clientId = '';
String clientSecret = '';
String reqbody = 'grant_type=password&client_id='+clientId+'&client_secret='+clientSecret+'&username=username&password=password';
@msrivastav13
msrivastav13 / gist:6291713
Last active March 9, 2021 14:20
Sending Email Notification In finish Method
global void finish(Database.BatchableContext BC) {
// Get the ID of the AsyncApexJob representing this batch job
// from Database.BatchableContext.
// Query the AsyncApexJob object to retrieve the current job's information.
AsyncApexJob a = [Select Id, Status,ExtendedStatus,NumberOfErrors, JobItemsProcessed,
TotalJobItems, CreatedBy.Email
from AsyncApexJob where Id =:BC.getJobId()];
<apex:page controller="winter14Ctrl" docType="html-5.0">
<apex:form >
<apex:pageBlock title="Winter 14 Visualforce Explore" >
<apex:pageBlockSection >
<apex:pageBlockSection >
<apex:outputLabel ></apex:outputLabel>
<apex:inputText label="Account" value="{!AccountName}" list="{!Accounts}"
public class winter14Ctrl {
public String AccountName{ get; set; }
public integer hello{ get; set; }
public Date fDate { get; set; }
public string email{get;set;}
public string phone{get;set;}
List<String> lstAccounts;
<apex:page controller="googleauthclass">
<apex:form >
<apex:commandButton value="Connect To Google" action="{!connect}"/>
<apex:commandButton value="Fetch Auth Token" action="{!showtoken}"/>
</apex:form>
{!bodyprint}
</apex:page>