Skip to content

Instantly share code, notes, and snippets.

View msrivastav13's full-sized avatar
🎯
Focusing

Mohith Shrivastava msrivastav13

🎯
Focusing
View GitHub Profile
trigger ContactTrigger on Contact (after delete, after insert, after undelete,
after update, before delete, before insert, before update) {
if(trigger.isAfter && trigger.isInsert){
Map<String,List<Contact>> mapIdByList=ParentChildMapHelper.buildGeneralisedMap('AccountId',trigger.new);
system.debug(mapIdByList);
}
}
Map<String,List<Contact>> mapIdByList=(Map<String,List<Contact>>)ParentChildMapHelper.buildGeneralisedMap('AccountId',lstsobject);
system.debug('My new Map '+mapIdByList);
global class WeatherApp implements Process.Plugin {
// The main method to be implemented. The Flow calls this at runtime.
global Process.PluginResult invoke(Process.PluginRequest request) {
// Get the State and City From Flow
String State = (String) request.inputParameters.get('state');
String City = (String) request.inputParameters.get('city');
// Use the API to call and fetch Weather Info
WeatherInfo weatherinformation=new WeatherInfo();
public class WeatherInfo {
public class Current_observation {
public Image image;
public Display_location display_location;
public Observation_location observation_location;
public Estimated estimated;
public String station_id;
public String observation_time;
public String observation_time_rfc822;
<!--*!
* @version 1.0
*
* A simple yet powerful JQuery star rating plugin that allows rendering
* fractional star ratings
*
* This pulgin is customized from JQuery plugins at http://plugins.krajee.com/star-rating
*
*-->
<apex:page sidebar="false" showHeader="false" applyHtmlTag="false" applyBodyTag="false" docType="html-5.0" controller="RatingDemoCtrl">
/*
@Name : RatingDemoCtrl
@description : The following class consists of logic to upsert the rating for Parent record.This plugin assumes Account has a Junction record where user rating is inserted
*/
public with sharing class RatingDemoCtrl{
public RatingDemoCtrl(){
lstacc=new List<Account>();
lstacc=[Select Id,Name,(Select RatingScore__c from Account_Ratings__r where User__c=:userinfo.getuserID() limit 1) from Account Limit 10];
}
@msrivastav13
msrivastav13 / OdataApp
Created January 3, 2015 10:56
WCF Data Services make it easy to create an OData service using an ADO.NET Entity Data Model by providing a generic DataService class that is constructed using an ADO.NET Entity Data Model.
//------------------------------------------------------------------------------
// <copyright file="WebDataService.svc.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Data.Services;
using System.Data.Services.Common;
using System.Linq;
@msrivastav13
msrivastav13 / TriggerLearnerTemplate
Created February 19, 2015 16:24
Trigger Template
trigger AccountTrigger on Account(before insert,after insert,before update,after update,before delete,after delete,after undelete){
if(trigger.isbefore && trigger.isinsert){
system.debug('BEFORE INSERT'+trigger.new);
}
if(trigger.isafter && trigger.isinsert){
system.debug('AFTER INSERT'+trigger.new);
system.debug('AFTER INSERT MAP'+trigger.newmap);
}
if(trigger.isafter && trigger.isupdate){
system.debug('AFTER UPDATE NEW'+trigger.new);
public class Futureapexcallout{
@future(Callout=true)
public static void apexcallout(string billingstate,string billingcity,Id AccountId){
// Instantiate a new http object
Http h = new Http();
// Instantiate a new HTTP request, specify the method (GET) as well as the endpoint
HttpRequest req = new HttpRequest();
public class LinkedInParser{
public String emailAddress{get;set;} //[email protected]
public String id{get;set;} //k4UiLk0S8c
public cls_languages languages{get;set;}
public cls_location location{get;set;}
public Integer numConnections{get;set;} //334
public String pictureUrl{get;set;} //https://media.licdn.com/mpr/mprx/0__HjzfUfekIOzW4-Rh2LzFgge5f3H7HlUWHWUWaIe5uiW742F7MLRG7EWFI7H7d2RdHLzT4dd2Ipd22OUWU4dF7kLWIpe22ecWU492mlHCodX6VPwLomZuVxJdY6Z5206h4yJwp-201P
public cls_publications publications{get;set;}
public cls_skills skills{get;set;}