This file contains 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
/* PRE - model declaration on vf page | |
<apex:remoteObjects> | |
<apex:remoteObjectModel name="Account" fields="Id,Name" /> | |
</apex:remoteObjects> | |
*/ | |
/* INSTANCE */ | |
// 1. W/o default properties | |
var acc = new SObjectModel.Account(); |
This file contains 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
<!-- visStyles Static resource for CSS styles --> | |
.gi-override { | |
position: relative; | |
} | |
.webrtc-container { | |
position: relative; | |
float: left; | |
width: 559px; | |
height: 420px; |
This file contains 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
@isTest | |
public class TestDataFactory { | |
public static Invoice__c createOneInvoiceStatement(Boolean withLineItem) { | |
// Create Warehouse if one does not exist | |
Warehouse__c w; | |
List<Warehouse__c> warehouse = [SELECT ID from Warehouse__c]; | |
if(warehouse.size() == 0) { | |
w = createWarehouseLocation('Warehouse 1'); | |
} else { | |
w = warehouse[0]; |
This file contains 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
@isTest | |
private class TestInvoiceStatementDeletion { | |
static testmethod void TestDeleteInvoiceWithLineItem() { | |
// Create an invoice with a line item then try to delete it | |
Invoice__c inv = TestDataFactory.createOneInvoiceStatement(true); | |
Test.startTest(); | |
Database.DeleteResult result = Database.delete(inv, false); | |
Test.stopTest(); | |
// Verify invoice with a line item didn't get deleted. | |
System.assert(!result.isSuccess()); |
This file contains 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
@isTest | |
private class TestCleanUpBatchClass { | |
static testmethod void test() { | |
// The query used by the batch job. | |
String query = 'SELECT Id,CreatedDate FROM Merchandise__c ' + | |
'WHERE Id NOT IN (SELECT Merchandise__c FROM Line_Item__c)'; | |
// Create some test merchandise items to be deleted by the batch job. | |
Warehouse__c w = new Warehouse__c( | |
Name='Warehouse 1', |
This file contains 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 CleanUpRecords implements Database.Batchable<sObject> { | |
global final String query; | |
global CleanUpRecords(String q) { | |
query = q; | |
} | |
global Database.QueryLocator start(Database.BatchableContext bc) { | |
return Database.getQueryLocator(query); | |
} |
This file contains 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 CreateMerchandiseData { | |
public static void ClearMerchandiseDataBatch() { | |
String query = 'SELECT Id,CreatedDate FROM Merchandise__c ' + | |
'WHERE Id NOT IN (SELECT Merchandise__c FROM Line_Item__c)'; | |
CleanUpRecords c = new CleanUpRecords(query); | |
Database.executeBatch(c); | |
} | |
public static void GenerateMerchandiseData() { |
This file contains 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 MyScheduler implements Schedulable { | |
global void execute(SchedulableContext ctx) { | |
// The query used by the batch job. | |
String query = 'SELECT Id,CreatedDate FROM Merchandise__c ' + | |
'WHERE Id NOT IN (SELECT Merchandise__c FROM Line_Item__c)'; | |
CleanUpRecords c = new CleanUpRecords(query); | |
Database.executeBatch(c); | |
} | |
This file contains 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
@if (ViewBag.ErrorMessage == "AuthorizationRequired") | |
{ | |
<p>You have to sign-in to @ViewBag.OperationName. Click <a href="@ViewBag.AuthorizationUrl" title="here">here</a> to sign-in.</p> | |
<p>@ViewBag.ErrorMessage</p> | |
} |
This file contains 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
This is tes |
OlderNewer