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
//------------------------------------------------------------------------------ | |
// <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; |
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
/* | |
@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]; | |
} |
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
<!--*! | |
* @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"> |
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
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; |
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 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(); |
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
Map<String,List<Contact>> mapIdByList=(Map<String,List<Contact>>)ParentChildMapHelper.buildGeneralisedMap('AccountId',lstsobject); | |
system.debug('My new Map '+mapIdByList); |
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
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); | |
} | |
} |
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
public class ParentChildMapHelper{ | |
public static Map<String,List<sobject>> buildGeneralisedMap(String fieldname,List<Sobject> lstsobject){ | |
Map<String,List<sobject>> mapIdbySobject=new Map<String,List<sobject>>(); | |
for(Sobject s:lstsobject){ | |
if (mapIdbySobject.containsKey((String)s.get(fieldname))){ | |
mapIdbySobject.get((String)s.get(fieldname)).add(s); //tricky part .Here map.get(key) is returning list and we are adding contacts to the list | |
} else{ | |
List <sobject> lstsobjects = new List <sobject> (); //Initialize list as no key is found before and first time we get key | |
lstsobjects.add(s); | |
mapIdbySobject.put((String)s.get(fieldname), lstsobjects); |
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
public class CommunityHelper{ | |
public static String communityId=Network.getNetworkId(); | |
public static ConnectApi.Community getCommunityInfo(){ | |
if(communityId!=null){ | |
return connectapi.Communities.getCommunity(communityId); | |
}else { | |
return null; | |
} |
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
$(function() { | |
Visualforce.remoting.Manager.invokeAction( | |
'{!$RemoteAction.MobileHomeCtrl.fetchallUsers}', | |
function(result, event){ | |
if (event.status) { | |
var availableTags = []; | |
$.each(result,function(){ | |
var obj = new Object(); | |
//match the passed label and returned value to populate the label and value | |
obj.label = this['FirstName']+' '+this['LastName']; |