• Kartheek Varma
  • NEWBIE
  • -1 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 6
    Questions
  • 7
    Replies
trigger SendAdmitCard on Admit_Card__c (after update) {
    
    Set<Admit_Card__c> admitCardDetails = new Set<Admit_Card__c>();
    if(Trigger.isInsert || Trigger.isUpdate) {
    for(Admit_Card__c admitCard : trigger.new){
        if(admitCard.FUA_Broadcast_Admit_Card__c){
            admitCardDetails.add(admitCard);
        }
    }
    }
    if(admitCardDetails.size()>0) AdmitCardDetailsHandler.CreateAdmitCard(admitCardDetails);
   
  
  
   
}
Hi,
I have created a VF page for force .com site in that page .i am passing id with page name  Url Like:https://kartheek-flameu.cs5.force.com/apex/ApplicationFormPDF?StaticContactId=003O0000015BzZYIA0 to Copy and past another browser to it can show the same page.How can I protect the URL in force .com site? Please help me.....
  We are trying to build one simple website using force.com sites.Here User logged into the website and need to perform different actions by moving to different VF pages.We are facing a Problem to does not maintain Session of the particular user.We need help regarding how to maintain the session for the particular user.My issue is I Can create  New URL to the site in the web browser by opening from another Browser to save the site URL  as the default home page and automatically display this same page will be displayed. Please give me the solution.
How to Rewrite URLs for Force.com Sites
 
 
 
trigger SendAdmitCard on Admit_Card__c (after update) {
    
    Set<Admit_Card__c> admitCardDetails = new Set<Admit_Card__c>();
    if(Trigger.isInsert || Trigger.isUpdate) {
    for(Admit_Card__c admitCard : trigger.new){
        if(admitCard.FUA_Broadcast_Admit_Card__c){
            admitCardDetails.add(admitCard);
        }
    }
    }
    if(admitCardDetails.size()>0) AdmitCardDetailsHandler.CreateAdmitCard(admitCardDetails);
   
  
  
   
}
I have the following apex trigger and I need a test class. Can you guys check what I got so far?

Apex Trigger
trigger NOVEMBER2 on OpportunityLineItem( after insert, after update )
{
    List<OpportunityLineItem> oliList = new List<OpportunityLineItem>();
    Set<Id> opptyIds = new Set<Id>();
 
    for( OpportunityLineItem optLineItem: trigger.new )
    {
        if( optLineItem.ProductCode == '00002a' )
        {
            opptyIds.add( optLineItem.OpportunityId );
        }
    }
 
    if( opptyIds.size() > 0 )
    {
        //retrieve the values based on Product list
        List<OpportunityLineItem> lstOpptyLineItems = [ SELECT Opportunity.Pricebook2Id, OpportunityId, Name, ProductCode,
                                                        PricebookEntryId, Quantity, UnitPrice
                                                        FROM OpportunityLineItem
                                                        WHERE OpportunityId IN: opptyIds order by ProductCode ];
 
        Map<Id, List<OpportunityLineItem>> mapOpptyLineItem = new Map<Id, List<OpportunityLineItem>>();
        for( OpportunityLineItem item : lstOpptyLineItems )
        {
            List<OpportunityLineItem> oliList1 = new List<OpportunityLineItem>();
            if( mapOpptyLineItem.containsKey( item.OpportunityId ))
            {
                oliList1 = mapOpptyLineItem.get( item.OpportunityId );
            }
            
            oliList1.add( item );
            mapOpptyLineItem.put( item.OpportunityId, oliList1 );
        }
 
 
        //retrieve PriceBookEntry of the Product B, this is most important
        PricebookEntry pbeProduct2 = [ SELECT Id, Pricebook2Id, UnitPrice, Name, Pass_Through_Percentage_Entry__c
                                        FROM PricebookEntry
                                        WHERE Name ='Car Oil Fee'
                                        AND Pricebook2Id  IN (SELECT Id FROM PriceBook2 WHERE Id ='01sA00000004lbRIAQ')
                                        LIMIT 1 ];
 
         if( trigger.isInsert )
         {
             for( Id oppId : mapOpptyLineItem.keySet() )
             {
                 for( OpportunityLineItem item : mapOpptyLineItem.get( oppId ))
                 {
                     if( item.ProductCode == '00002a' )
                     {
                         oliList.add( new OpportunityLineItem(
                                            OpportunityId = oppId,
                                            PricebookEntryId = pbeProduct2.Id,
                                            Quantity = item.Quantity,
                                            UnitPrice = item.UnitPrice * pbeProduct2.Pass_Through_Percentage_Entry__c * 0.01 )
                                          );
                     }
                 }
             }
             
             if( oliList.size() > 0 )
                 insert oliList;
         }
         else if( trigger.isUpdate )
         {
             for( Id oppId : mapOpptyLineItem.keySet() )
             {
                 OpportunityLineItem itemProductA = new OpportunityLineItem();
                 for( OpportunityLineItem item : mapOpptyLineItem.get( oppId ))
                 {
                     if( item.ProductCode == '00002a' )
                     {
                         itemProductA = item;
                         continue;
                     }
                     if( item.ProductCode == '00002b' )
                     {
                         oliList.add( new OpportunityLineItem( Id = item.Id,
                                            OpportunityId = oppId,
                                            PricebookEntryId = pbeProduct2.Id,
                                            Quantity = itemProductA.Quantity,
                                            UnitPrice = itemProductA.UnitPrice * pbeProduct2.Pass_Through_Percentage_Entry__c * 0.01 )
                                          );
                     }
                 }
             }
             
             if( oliList.size() > 0 )
                 update oliList;
         }
    }
}
Test Class:
@isTest
private class OpportunityLineItemTrigger_Test{
  static testMethod void test_OpportunityLineItemTrigger(){
   test.startTest();
    OpportunityLineItem opportunitylineitem_Obj = new OpportunityLineItem(OpportunityId = opportunity_Obj[0].id, PricebookEntryId = pricebookentry_Obj[0].id, Quantity = 9, UnitPrice = 13, Package_Delivery_Date__c = false, Batch_Readiness__c = false);
    Insert opportunitylineitem_Obj; 
   test.stopTest();
  }

  static testMethod void test_UseCase2(){
   test.startTest();
    OpportunityLineItem opportunitylineitem_Obj = new OpportunityLineItem(OpportunityId = opportunity_Obj[0].id, PricebookEntryId = pricebookentry_Obj[0].id, Quantity = 9, UnitPrice = 13, Package_Delivery_Date__c = false, Batch_Readiness__c = false);
    opportunitylineitem_Obj.ProductCode='UseCase1-0';
    Insert opportunitylineitem_Obj; 
    test.stopTest();
}
}


 
  • November 22, 2017
  • Like
  • 0
How to Rewrite URLs for Force.com Sites
 
 
 
Anyone help me. How i can upload file to dropbox with dropbox api?  Thanks